{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveLift #-}
{-# HLINT ignore "Eta reduce" #-}
{-# HLINT ignore "Unused LANGUAGE pragma" #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
module Grisette.Internal.SymPrim.Prim.Internal.Term
(
SupportedPrimConstraint (..),
SupportedPrim (..),
SymRep (..),
ConRep (..),
LinkedRep (..),
PEvalApplyTerm (..),
PEvalBitwiseTerm (..),
PEvalShiftTerm (..),
PEvalRotateTerm (..),
PEvalNumTerm (..),
pevalSubNumTerm,
PEvalOrdTerm (..),
pevalGtOrdTerm,
pevalGeOrdTerm,
pevalNEqTerm,
PEvalDivModIntegralTerm (..),
PEvalBitCastTerm (..),
PEvalBitCastOrTerm (..),
PEvalBVTerm (..),
PEvalFractionalTerm (..),
PEvalFPTerm (..),
PEvalFloatingTerm (..),
PEvalFromIntegralTerm (..),
PEvalIEEEFPConvertibleTerm (..),
SymbolKind (..),
TypedSymbol (TypedSymbol, unTypedSymbol),
typedConstantSymbol,
typedAnySymbol,
TypedConstantSymbol,
TypedAnySymbol,
SomeTypedSymbol (..),
SomeTypedConstantSymbol,
SomeTypedAnySymbol,
IsSymbolKind (..),
showUntyped,
someTypedSymbol,
eqHeteroSymbol,
castSomeTypedSymbol,
FPTrait (..),
FPUnaryOp (..),
FPBinaryOp (..),
FPRoundingUnaryOp (..),
FPRoundingBinaryOp (..),
FloatingUnaryOp (..),
Term (..),
defaultValueDynamic,
pattern DynTerm,
toCurThread,
CachedInfo (..),
termInfo,
termThreadId,
termDigest,
termId,
termStableIdent,
pformatTerm,
ModelValue (..),
toModelValue,
unsafeFromModelValue,
UTerm (..),
prettyPrintTerm,
conTerm,
symTerm,
ssymTerm,
isymTerm,
forallTerm,
existsTerm,
notTerm,
orTerm,
andTerm,
eqTerm,
distinctTerm,
iteTerm,
addNumTerm,
negNumTerm,
mulNumTerm,
absNumTerm,
signumNumTerm,
ltOrdTerm,
leOrdTerm,
andBitsTerm,
orBitsTerm,
xorBitsTerm,
complementBitsTerm,
shiftLeftTerm,
rotateLeftTerm,
shiftRightTerm,
rotateRightTerm,
bitCastTerm,
bitCastOrTerm,
bvConcatTerm,
bvSelectTerm,
bvExtendTerm,
bvsignExtendTerm,
bvzeroExtendTerm,
applyTerm,
divIntegralTerm,
modIntegralTerm,
quotIntegralTerm,
remIntegralTerm,
fpTraitTerm,
fdivTerm,
recipTerm,
floatingUnaryTerm,
powerTerm,
fpUnaryTerm,
fpBinaryTerm,
fpRoundingUnaryTerm,
fpRoundingBinaryTerm,
fpFMATerm,
fromIntegralTerm,
fromFPOrTerm,
toFPTerm,
pattern SupportedTerm,
pattern SupportedTypedSymbol,
pattern SupportedConstantTypedSymbol,
pattern ConTerm,
pattern SymTerm,
pattern ForallTerm,
pattern ExistsTerm,
pattern NotTerm,
pattern OrTerm,
pattern AndTerm,
pattern OrTermAll,
pattern AndTermAll,
pattern EqTerm,
pattern DistinctTerm,
pattern ITETerm,
pattern AddNumTerm,
pattern NegNumTerm,
pattern MulNumTerm,
pattern AbsNumTerm,
pattern SignumNumTerm,
pattern LtOrdTerm,
pattern LeOrdTerm,
pattern AndBitsTerm,
pattern OrBitsTerm,
pattern XorBitsTerm,
pattern ComplementBitsTerm,
pattern ShiftLeftTerm,
pattern RotateLeftTerm,
pattern ShiftRightTerm,
pattern RotateRightTerm,
pattern BitCastTerm,
pattern BitCastOrTerm,
pattern BVConcatTerm,
pattern BVSelectTerm,
pattern BVExtendTerm,
pattern ApplyTerm,
pattern DivIntegralTerm,
pattern ModIntegralTerm,
pattern QuotIntegralTerm,
pattern RemIntegralTerm,
pattern FPTraitTerm,
pattern FdivTerm,
pattern RecipTerm,
pattern FloatingUnaryTerm,
pattern PowerTerm,
pattern FPUnaryTerm,
pattern FPBinaryTerm,
pattern FPRoundingUnaryTerm,
pattern FPRoundingBinaryTerm,
pattern FPFMATerm,
pattern FromIntegralTerm,
pattern FromFPOrTerm,
pattern ToFPTerm,
trueTerm,
falseTerm,
pattern BoolConTerm,
pattern TrueTerm,
pattern FalseTerm,
pattern BoolTerm,
pevalNotTerm,
pevalOrTerm,
pevalAndTerm,
pevalImplyTerm,
pevalXorTerm,
pevalITEBasic,
pevalITEBasicTerm,
pevalDefaultEqTerm,
NonFuncPrimConstraint,
NonFuncSBVRep (..),
SupportedNonFuncPrim (..),
SBVRep (..),
SBVFreshMonad (..),
translateTypeError,
parseSMTModelResultError,
partitionCVArg,
parseScalarSMTModelResult,
bvIsNonZeroFromGEq1,
PartialFun,
PartialRuleUnary,
TotalRuleUnary,
PartialRuleBinary,
TotalRuleBinary,
totalize,
totalize2,
UnaryPartialStrategy (..),
unaryPartial,
BinaryCommPartialStrategy (..),
BinaryPartialStrategy (..),
binaryPartial,
unaryUnfoldOnce,
binaryUnfoldOnce,
generalUnaryUnfolded,
generalBinaryUnfolded,
unsafePevalBVConcatTerm,
unsafePevalBVExtendTerm,
unsafePevalBVSelectTerm,
boolToBVTerm,
pevalDefaultAddNumTerm,
pevalDefaultNegNumTerm,
pevalDefaultMulNumTerm,
pevalBitsAbsNumTerm,
doPevalNoOverflowAbsNumTerm,
pevalGeneralSignumNumTerm,
doPevalNoOverflowSignumNumTerm,
)
where
#if MIN_VERSION_prettyprinter(1,7,0)
import Prettyprinter
( column,
pageWidth,
Doc,
PageWidth(Unbounded, AvailablePerLine),
Pretty(pretty),
)
#else
import Data.Text.Prettyprint.Doc
( column,
pageWidth,
Doc,
PageWidth(Unbounded, AvailablePerLine),
Pretty(pretty),
)
#endif
#if !MIN_VERSION_sbv(10,0,0)
#define SMTDefinable Uninterpreted
#endif
#if MIN_VERSION_sbv(11,0,0)
import qualified Data.SBV as SBVTC
#endif
#if MIN_VERSION_base(4,15,0)
import Language.Haskell.TH (Code, Quote)
#else
import Language.Haskell.TH (TExpQ)
#endif
import Control.DeepSeq (NFData (rnf))
import Control.Monad (msum)
import Control.Monad.Except (MonadError (catchError))
import Control.Monad.IO.Class (MonadIO)
import qualified Control.Monad.RWS.Lazy as Lazy
import qualified Control.Monad.RWS.Strict as Strict
import Control.Monad.Reader (MonadTrans (lift), ReaderT)
import qualified Control.Monad.State.Lazy as Lazy
import qualified Control.Monad.State.Strict as Strict
import qualified Control.Monad.Writer.Lazy as Lazy
import qualified Control.Monad.Writer.Strict as Strict
import Data.Atomics (atomicModifyIORefCAS_)
import qualified Data.Binary as Binary
import Data.Bits
( Bits (complement, isSigned, xor, zeroBits, (.&.), (.|.)),
FiniteBits (countLeadingZeros),
)
import Data.Bytes.Serial (Serial (deserialize, serialize))
import Data.Coerce (coerce)
import qualified Data.HashMap.Strict as HM
import qualified Data.HashSet as HS
import Data.Hashable (Hashable (hashWithSalt))
import Data.IORef (IORef, newIORef, readIORef)
import Data.Kind (Constraint, Type)
import Data.List.NonEmpty (NonEmpty ((:|)), toList)
import Data.Maybe (fromMaybe, isJust)
import Data.Proxy (Proxy (Proxy))
import Data.SBV (BVIsNonZero)
import qualified Data.SBV as SBV
import qualified Data.SBV.Dynamic as SBVD
import qualified Data.SBV.Trans as SBVT
import qualified Data.SBV.Trans.Control as SBVTC
import qualified Data.Serialize as Cereal
import Data.String (IsString (fromString))
import Data.Type.Equality ((:~:) (Refl), type (:~~:) (HRefl))
import Data.Typeable (Typeable, cast, typeRepFingerprint)
import GHC.Exts (Any, sortWith)
import GHC.Fingerprint (Fingerprint)
import GHC.Generics (Generic)
import GHC.IO (unsafePerformIO)
import GHC.Stack (HasCallStack)
import GHC.TypeNats (KnownNat, Nat, natVal, sameNat, type (+), type (-), type (<=))
import Grisette.Internal.Core.Data.Class.BitCast (BitCast (bitCast), BitCastOr)
import Grisette.Internal.Core.Data.Class.BitVector
( SizedBV
( sizedBVConcat,
sizedBVFromIntegral,
sizedBVSelect,
sizedBVSext,
sizedBVZext
),
)
import Grisette.Internal.Core.Data.Class.IEEEFP
( fpIsNegativeZero,
fpIsPositiveZero,
)
import Grisette.Internal.Core.Data.Symbol
( Identifier,
Symbol (IndexedSymbol, SimpleSymbol),
)
import Grisette.Internal.SymPrim.AlgReal (AlgReal, fromSBVAlgReal, toSBVAlgReal)
import Grisette.Internal.SymPrim.BV (IntN, WordN)
import Grisette.Internal.SymPrim.FP
( FP (FP),
FPRoundingMode (RNA, RNE, RTN, RTP, RTZ),
ValidFP,
)
import Grisette.Internal.SymPrim.Prim.Internal.Caches
( CachedInfo
( CachedInfo,
cachedDigest,
cachedId,
cachedStableIdent,
cachedThreadId
),
Digest,
Id,
Interned
( Description,
Uninterned,
describe,
descriptionDigest,
identify,
threadId
),
StableIdent,
intern,
)
import Grisette.Internal.SymPrim.Prim.Internal.Utils
( WeakThreadId,
myWeakThreadId,
)
import Grisette.Internal.Utils.Parameterized
( LeqProof (LeqProof),
NatRepr,
SomeNatRepr (SomeNatRepr),
SomePositiveNatRepr (SomePositiveNatRepr),
addNat,
mkNatRepr,
mkPositiveNatRepr,
natRepr,
unsafeAxiom,
unsafeKnownProof,
unsafeLeqProof,
withKnownNat,
withKnownProof,
)
import Language.Haskell.TH.Syntax (Lift (liftTyped))
import Type.Reflection
( SomeTypeRep (SomeTypeRep),
TypeRep,
eqTypeRep,
someTypeRep,
typeRep,
)
import qualified Type.Reflection as R
import Unsafe.Coerce (unsafeCoerce)
class (MonadIO m) => SBVFreshMonad m where
sbvFresh :: (SBV.SymVal a) => String -> m (SBV.SBV a)
instance (MonadIO m) => SBVFreshMonad (SBVT.SymbolicT m) where
sbvFresh :: forall a. SymVal a => String -> SymbolicT m (SBV a)
sbvFresh = String -> SymbolicT m (SBV a)
forall a (m :: * -> *).
(SymVal a, MonadSymbolic m) =>
String -> m (SBV a)
forall (m :: * -> *). MonadSymbolic m => String -> m (SBV a)
SBVT.free
{-# INLINE sbvFresh #-}
instance (MonadIO m) => SBVFreshMonad (SBVTC.QueryT m) where
sbvFresh :: forall a. SymVal a => String -> QueryT m (SBV a)
sbvFresh = String -> QueryT m (SBV a)
forall a (m :: * -> *).
(MonadIO m, MonadQuery m, SymVal a) =>
String -> m (SBV a)
SBVTC.freshVar
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m) => SBVFreshMonad (ReaderT r m) where
sbvFresh :: forall a. SymVal a => String -> ReaderT r m (SBV a)
sbvFresh = m (SBV a) -> ReaderT r m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> ReaderT r m (SBV a))
-> (String -> m (SBV a)) -> String -> ReaderT r m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Lazy.WriterT w m) where
sbvFresh :: forall a. SymVal a => String -> WriterT w m (SBV a)
sbvFresh = m (SBV a) -> WriterT w m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> WriterT w m (SBV a))
-> (String -> m (SBV a)) -> String -> WriterT w m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Lazy.RWST r w s m) where
sbvFresh :: forall a. SymVal a => String -> RWST r w s m (SBV a)
sbvFresh = m (SBV a) -> RWST r w s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> RWST r w s m (SBV a))
-> (String -> m (SBV a)) -> String -> RWST r w s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m) => SBVFreshMonad (Lazy.StateT s m) where
sbvFresh :: forall a. SymVal a => String -> StateT s m (SBV a)
sbvFresh = m (SBV a) -> StateT s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> StateT s m (SBV a))
-> (String -> m (SBV a)) -> String -> StateT s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Strict.WriterT w m) where
sbvFresh :: forall a. SymVal a => String -> WriterT w m (SBV a)
sbvFresh = m (SBV a) -> WriterT w m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> WriterT w m (SBV a))
-> (String -> m (SBV a)) -> String -> WriterT w m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Strict.RWST r w s m) where
sbvFresh :: forall a. SymVal a => String -> RWST r w s m (SBV a)
sbvFresh = m (SBV a) -> RWST r w s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> RWST r w s m (SBV a))
-> (String -> m (SBV a)) -> String -> RWST r w s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
instance (SBVFreshMonad m) => SBVFreshMonad (Strict.StateT s m) where
sbvFresh :: forall a. SymVal a => String -> StateT s m (SBV a)
sbvFresh = m (SBV a) -> StateT s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> StateT s m (SBV a))
-> (String -> m (SBV a)) -> String -> StateT s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
{-# INLINE sbvFresh #-}
translateTypeError :: (HasCallStack) => Maybe String -> TypeRep a -> b
translateTypeError :: forall a b. HasCallStack => Maybe String -> TypeRep a -> b
translateTypeError Maybe String
Nothing TypeRep a
ta =
String -> b
forall a. HasCallStack => String -> a
error (String -> b) -> String -> b
forall a b. (a -> b) -> a -> b
$
String
"Don't know how to translate the type " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ta String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" to SMT"
translateTypeError (Just String
reason) TypeRep a
ta =
String -> b
forall a. HasCallStack => String -> a
error (String -> b) -> String -> b
forall a b. (a -> b) -> a -> b
$
String
"Don't know how to translate the type " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ta String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" to SMT: " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
reason
class
( SupportedPrim a,
Ord a,
Eq a,
Show a,
Hashable a,
Typeable a
) =>
NonFuncSBVRep a
where
type NonFuncSBVBaseType a
type NonFuncPrimConstraint a =
( SBV.SymVal (NonFuncSBVBaseType a),
SBV.EqSymbolic (SBVType a),
SBV.Mergeable (SBVType a),
SBV.SMTDefinable (SBVType a),
SBV.Mergeable (SBVType a),
SBVType a ~ SBV.SBV (NonFuncSBVBaseType a),
PrimConstraint a
)
class (NonFuncSBVRep a) => SupportedNonFuncPrim a where
conNonFuncSBVTerm :: a -> SBV.SBV (NonFuncSBVBaseType a)
symNonFuncSBVTerm ::
(SBVFreshMonad m) => String -> m (SBV.SBV (NonFuncSBVBaseType a))
withNonFuncPrim :: ((NonFuncPrimConstraint a) => r) -> r
partitionCVArg ::
forall a.
(SupportedNonFuncPrim a) =>
[([SBVD.CV], SBVD.CV)] ->
[(a, [([SBVD.CV], SBVD.CV)])]
partitionCVArg :: forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
partitionCVArg [([CV], CV)]
cv =
[(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall a.
SupportedNonFuncPrim a =>
[(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
partitionOrdCVArg ([(a, [([CV], CV)])] -> [(a, [([CV], CV)])])
-> [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall a b. (a -> b) -> a -> b
$
[([CV], CV)] -> [(a, [([CV], CV)])]
forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
parseFirstCVArg [([CV], CV)]
cv
where
parseFirstCVArg ::
forall a.
(SupportedNonFuncPrim a) =>
[([SBVD.CV], SBVD.CV)] ->
[(a, [([SBVD.CV], SBVD.CV)])]
parseFirstCVArg :: forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
parseFirstCVArg =
(([CV], CV) -> (a, [([CV], CV)]))
-> [([CV], CV)] -> [(a, [([CV], CV)])]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
( \case
(CV
x : [CV]
xs, CV
v) ->
(Int -> ([([CV], CV)], CV) -> a
forall t. SupportedPrim t => Int -> ([([CV], CV)], CV) -> t
parseSMTModelResult Int
0 ([], CV
x), [([CV]
xs, CV
v)])
([CV], CV)
_ -> String -> (a, [([CV], CV)])
forall a. HasCallStack => String -> a
error String
"impossible"
)
partitionOrdCVArg ::
forall a.
(SupportedNonFuncPrim a) =>
[(a, [([SBVD.CV], SBVD.CV)])] ->
[(a, [([SBVD.CV], SBVD.CV)])]
partitionOrdCVArg :: forall a.
SupportedNonFuncPrim a =>
[(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
partitionOrdCVArg [(a, [([CV], CV)])]
v = [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall {a} {a}. Eq a => [(a, [a])] -> [(a, [a])]
go [(a, [([CV], CV)])]
sorted
where
sorted :: [(a, [([CV], CV)])]
sorted = ((a, [([CV], CV)]) -> a)
-> [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortWith (a, [([CV], CV)]) -> a
forall a b. (a, b) -> a
fst [(a, [([CV], CV)])]
v :: [(a, [([SBVD.CV], SBVD.CV)])]
go :: [(a, [a])] -> [(a, [a])]
go ((a, [a])
x : (a, [a])
x1 : [(a, [a])]
xs) =
if (a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== (a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x1
then [(a, [a])] -> [(a, [a])]
go ([(a, [a])] -> [(a, [a])]) -> [(a, [a])] -> [(a, [a])]
forall a b. (a -> b) -> a -> b
$ ((a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x, (a, [a]) -> [a]
forall a b. (a, b) -> b
snd (a, [a])
x [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ (a, [a]) -> [a]
forall a b. (a, b) -> b
snd (a, [a])
x1) (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])]
xs
else (a, [a])
x (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])] -> [(a, [a])]
go ((a, [a])
x1 (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])]
xs)
go [(a, [a])]
x = [(a, [a])]
x
parseScalarSMTModelResult ::
forall v r.
(SBVT.SatModel r, Typeable v) =>
(r -> v) ->
([([SBVD.CV], SBVD.CV)], SBVD.CV) ->
v
parseScalarSMTModelResult :: forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult r -> v
convert cvs :: ([([CV], CV)], CV)
cvs@([], CV
v) = case [CV] -> Maybe (r, [CV])
forall a. SatModel a => [CV] -> Maybe (a, [CV])
SBVT.parseCVs [CV
v] of
Just (r
x, [CV]
_) -> r -> v
convert r
x
Maybe (r, [CV])
Nothing -> TypeRep v -> ([([CV], CV)], CV) -> v
forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @v) ([([CV], CV)], CV)
cvs
parseScalarSMTModelResult r -> v
_ ([([CV], CV)], CV)
cv = TypeRep v -> ([([CV], CV)], CV) -> v
forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @v) ([([CV], CV)], CV)
cv
class SBVRep t where
type SBVType t
class SupportedPrimConstraint t where
type PrimConstraint t :: Constraint
type PrimConstraint _ = ()
class
( Lift t,
NFData t,
Typeable t,
SupportedPrimConstraint t,
SBVRep t
) =>
SupportedPrim t
where
primTypeRep :: TypeRep t
default primTypeRep :: (Typeable t) => TypeRep t
primTypeRep = TypeRep t
forall {k} (a :: k). Typeable a => TypeRep a
typeRep
sameCon :: t -> t -> Bool
default sameCon :: (Eq t) => t -> t -> Bool
sameCon = t -> t -> Bool
forall a. Eq a => a -> a -> Bool
(==)
hashConWithSalt :: Int -> t -> Int
default hashConWithSalt :: (Hashable t) => Int -> t -> Int
hashConWithSalt = Int -> t -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt
pformatCon :: t -> String
default pformatCon :: (Show t) => t -> String
pformatCon = t -> String
forall a. Show a => a -> String
show
defaultValue :: t
pevalITETerm :: Term Bool -> Term t -> Term t -> Term t
pevalEqTerm :: Term t -> Term t -> Term Bool
pevalDistinctTerm :: NonEmpty (Term t) -> Term Bool
conSBVTerm :: t -> SBVType t
symSBVName :: TypedSymbol 'AnyKind t -> Int -> String
symSBVTerm :: (SBVFreshMonad m) => String -> m (SBVType t)
default withPrim ::
( PrimConstraint t,
SBV.SMTDefinable (SBVType t),
SBV.Mergeable (SBVType t),
Typeable (SBVType t)
) =>
( ( PrimConstraint t,
SBV.SMTDefinable (SBVType t),
SBV.Mergeable (SBVType t),
Typeable (SBVType t)
) =>
a
) ->
a
withPrim ::
( ( PrimConstraint t,
SBV.SMTDefinable (SBVType t),
SBV.Mergeable (SBVType t),
Typeable (SBVType t)
) =>
a
) ->
a
withPrim (PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
Typeable (SBVType t)) =>
a
i = a
(PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
Typeable (SBVType t)) =>
a
i
{-# INLINE withPrim #-}
sbvIte :: SBV.SBV Bool -> SBVType t -> SBVType t -> SBVType t
sbvIte = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @t SBV Bool -> SBVType t -> SBVType t -> SBVType t
(PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
Typeable (SBVType t)) =>
SBV Bool -> SBVType t -> SBVType t -> SBVType t
forall a. Mergeable a => SBV Bool -> a -> a -> a
SBV.ite
sbvEq :: SBVType t -> SBVType t -> SBV.SBV Bool
default sbvEq ::
(SBVT.EqSymbolic (SBVType t)) => SBVType t -> SBVType t -> SBV.SBV Bool
sbvEq = SBVType t -> SBVType t -> SBV Bool
forall a. EqSymbolic a => a -> a -> SBV Bool
(SBV..==)
sbvDistinct :: NonEmpty (SBVType t) -> SBV.SBV Bool
default sbvDistinct ::
(SBVT.EqSymbolic (SBVType t)) => NonEmpty (SBVType t) -> SBV.SBV Bool
sbvDistinct = [SBVType t] -> SBV Bool
forall a. EqSymbolic a => [a] -> SBV Bool
SBV.distinct ([SBVType t] -> SBV Bool)
-> (NonEmpty (SBVType t) -> [SBVType t])
-> NonEmpty (SBVType t)
-> SBV Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (SBVType t) -> [SBVType t]
forall a. NonEmpty a -> [a]
toList
parseSMTModelResult :: Int -> ([([SBVD.CV], SBVD.CV)], SBVD.CV) -> t
castTypedSymbol ::
(IsSymbolKind knd') => TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
funcDummyConstraint :: SBVType t -> SBV.SBV Bool
defaultValueDynamic ::
forall t proxy. (SupportedPrim t) => proxy t -> ModelValue
defaultValueDynamic :: forall t (proxy :: * -> *).
SupportedPrim t =>
proxy t -> ModelValue
defaultValueDynamic proxy t
_ = t -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
toModelValue (forall t. SupportedPrim t => t
defaultValue @t)
data ModelValue where
ModelValue :: forall v. (SupportedPrim v) => v -> ModelValue
instance NFData ModelValue where
rnf :: ModelValue -> ()
rnf (ModelValue v
v) = v -> ()
forall a. NFData a => a -> ()
rnf v
v
instance Lift ModelValue where
liftTyped :: forall (m :: * -> *). Quote m => ModelValue -> Code m ModelValue
liftTyped (ModelValue v
v) = [||v -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
ModelValue v
v||]
instance Show ModelValue where
show :: ModelValue -> String
show (ModelValue (v
v :: v)) = v -> String
forall t. SupportedPrim t => t -> String
pformatCon v
v String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" :: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep v -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)
instance Eq ModelValue where
(ModelValue (v
v1 :: v1)) == :: ModelValue -> ModelValue -> Bool
== (ModelValue (v
v2 :: v2)) =
case TypeRep v -> TypeRep v -> Maybe (v :~~: v)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @v1) (forall t. SupportedPrim t => TypeRep t
primTypeRep @v2) of
Just v :~~: v
HRefl -> v -> v -> Bool
forall t. SupportedPrim t => t -> t -> Bool
sameCon v
v1 v
v
v2
Maybe (v :~~: v)
_ -> Bool
False
instance Hashable ModelValue where
Int
s hashWithSalt :: Int -> ModelValue -> Int
`hashWithSalt` (ModelValue (v
v :: v)) =
(Int
s Int -> TypeRep v -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)) Int -> v -> Int
forall t. SupportedPrim t => Int -> t -> Int
`hashConWithSalt` v
v
unsafeFromModelValue :: forall a. (Typeable a) => ModelValue -> a
unsafeFromModelValue :: forall a. Typeable a => ModelValue -> a
unsafeFromModelValue (ModelValue (v
v :: v)) =
case TypeRep v -> TypeRep a -> Maybe (v :~~: a)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @v) (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @a) of
Just v :~~: a
HRefl -> a
v
v
Maybe (v :~~: a)
_ ->
String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$
String
"Bad model value type, expected type: "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @a)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", but got: "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep v -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)
toModelValue :: forall a. (SupportedPrim a) => a -> ModelValue
toModelValue :: forall a. SupportedPrim a => a -> ModelValue
toModelValue = a -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
ModelValue
castSomeTypedSymbol ::
(IsSymbolKind knd') => SomeTypedSymbol knd -> Maybe (SomeTypedSymbol knd')
castSomeTypedSymbol :: forall (knd' :: SymbolKind) (knd :: SymbolKind).
IsSymbolKind knd' =>
SomeTypedSymbol knd -> Maybe (SomeTypedSymbol knd')
castSomeTypedSymbol (SomeTypedSymbol s :: TypedSymbol knd t
s@TypedSymbol {}) =
TypedSymbol knd' t -> SomeTypedSymbol knd'
forall (knd :: SymbolKind) bv.
TypedSymbol knd bv -> SomeTypedSymbol knd
SomeTypedSymbol (TypedSymbol knd' t -> SomeTypedSymbol knd')
-> Maybe (TypedSymbol knd' t) -> Maybe (SomeTypedSymbol knd')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
forall t (knd' :: SymbolKind) (knd :: SymbolKind).
(SupportedPrim t, IsSymbolKind knd') =>
TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
forall (knd' :: SymbolKind) (knd :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
castTypedSymbol TypedSymbol knd t
s
{-# INLINE castSomeTypedSymbol #-}
parseSMTModelResultError ::
(HasCallStack) => TypeRep a -> ([([SBVD.CV], SBVD.CV)], SBVD.CV) -> a
parseSMTModelResultError :: forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError TypeRep a
ty ([([CV], CV)], CV)
cv =
String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$
String
"BUG: cannot parse SBV model value \""
String -> String -> String
forall a. Semigroup a => a -> a -> a
<> ([([CV], CV)], CV) -> String
forall a. Show a => a -> String
show ([([CV], CV)], CV)
cv
String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"\" to Grisette model value with the type "
String -> String -> String
forall a. Semigroup a => a -> a -> a
<> TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ty
pevalNEqTerm :: (SupportedPrim a) => Term a -> Term a -> Term Bool
pevalNEqTerm :: forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalNEqTerm Term a
l Term a
r = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term a
l Term a
r
{-# INLINE pevalNEqTerm #-}
class ConRep sym where
type ConType sym
class (SupportedPrim con) => SymRep con where
type SymType con
class
(ConRep sym, SymRep con, sym ~ SymType con, con ~ ConType sym) =>
LinkedRep con sym
| con -> sym,
sym -> con
where
underlyingTerm :: sym -> Term con
wrapTerm :: Term con -> sym
class PEvalApplyTerm f a b | f -> a b where
pevalApplyTerm :: Term f -> Term a -> Term b
sbvApplyTerm :: SBVType f -> SBVType a -> SBVType b
class PEvalBitwiseTerm t where
pevalAndBitsTerm :: Term t -> Term t -> Term t
pevalOrBitsTerm :: Term t -> Term t -> Term t
pevalXorBitsTerm :: Term t -> Term t -> Term t
pevalComplementBitsTerm :: Term t -> Term t
withSbvBitwiseTermConstraint :: (((Bits (SBVType t)) => r)) -> r
sbvAndBitsTerm :: SBVType t -> SBVType t -> SBVType t
sbvAndBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
(SBV..&.)
sbvOrBitsTerm :: SBVType t -> SBVType t -> SBVType t
sbvOrBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
(SBV..|.)
sbvXorBitsTerm :: SBVType t -> SBVType t -> SBVType t
sbvXorBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
SBV.xor
sbvComplementBitsTerm :: SBVType t -> SBVType t
sbvComplementBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t
SBVType t -> SBVType t
forall a. Bits a => a -> a
SBV.complement
class PEvalShiftTerm t where
pevalShiftLeftTerm :: Term t -> Term t -> Term t
pevalShiftRightTerm :: Term t -> Term t -> Term t
withSbvShiftTermConstraint ::
(((SBV.SIntegral (NonFuncSBVBaseType t)) => r)) -> r
sbvShiftLeftTerm :: SBVType t -> SBVType t -> SBVType t
default sbvShiftLeftTerm ::
(SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
sbvShiftLeftTerm SBVType t
l SBVType t
r =
forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalShiftTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvShiftTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sShiftLeft SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
default sbvShiftRightTerm ::
(SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
sbvShiftRightTerm :: SBVType t -> SBVType t -> SBVType t
sbvShiftRightTerm SBVType t
l SBVType t
r =
forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalShiftTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvShiftTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sShiftRight SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
class PEvalRotateTerm t where
pevalRotateLeftTerm :: Term t -> Term t -> Term t
pevalRotateRightTerm :: Term t -> Term t -> Term t
withSbvRotateTermConstraint ::
(((SBV.SIntegral (NonFuncSBVBaseType t)) => r)) -> r
sbvRotateLeftTerm :: SBVType t -> SBVType t -> SBVType t
default sbvRotateLeftTerm ::
(SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
sbvRotateLeftTerm SBVType t
l SBVType t
r =
forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalRotateTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvRotateTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sRotateLeft SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
sbvRotateRightTerm :: SBVType t -> SBVType t -> SBVType t
default sbvRotateRightTerm ::
(SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
sbvRotateRightTerm SBVType t
l SBVType t
r =
forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalRotateTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvRotateTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sRotateRight SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
class (Num t) => PEvalNumTerm t where
pevalAddNumTerm :: Term t -> Term t -> Term t
pevalNegNumTerm :: Term t -> Term t
pevalMulNumTerm :: Term t -> Term t -> Term t
pevalAbsNumTerm :: Term t -> Term t
pevalSignumNumTerm :: Term t -> Term t
withSbvNumTermConstraint :: (((Num (SBVType t)) => r)) -> r
sbvAddNumTerm ::
SBVType t ->
SBVType t ->
SBVType t
sbvAddNumTerm SBVType t
l SBVType t
r = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Num a => a -> a -> a
+ SBVType t
r
sbvNegNumTerm ::
SBVType t ->
SBVType t
sbvNegNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ -SBVType t
l
sbvMulNumTerm ::
SBVType t ->
SBVType t ->
SBVType t
sbvMulNumTerm SBVType t
l SBVType t
r = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Num a => a -> a -> a
* SBVType t
r
sbvAbsNumTerm ::
SBVType t ->
SBVType t
sbvAbsNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Num a => a -> a
abs SBVType t
l
sbvSignumNumTerm ::
SBVType t ->
SBVType t
sbvSignumNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Num a => a -> a
signum SBVType t
l
pevalSubNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
pevalSubNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalSubNumTerm Term a
l Term a
r = Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
l (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm Term a
r)
class PEvalOrdTerm t where
pevalLtOrdTerm :: Term t -> Term t -> Term Bool
pevalLeOrdTerm :: Term t -> Term t -> Term Bool
withSbvOrdTermConstraint :: (((SBV.OrdSymbolic (SBVType t)) => r)) -> r
sbvLtOrdTerm ::
SBVType t ->
SBVType t ->
SBV.SBV Bool
sbvLtOrdTerm SBVType t
l SBVType t
r = forall t r. PEvalOrdTerm t => (OrdSymbolic (SBVType t) => r) -> r
withSbvOrdTermConstraint @t ((OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool)
-> (OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBV Bool
forall a. OrdSymbolic a => a -> a -> SBV Bool
SBV..< SBVType t
r
sbvLeOrdTerm :: SBVType t -> SBVType t -> SBV.SBV Bool
sbvLeOrdTerm SBVType t
l SBVType t
r = forall t r. PEvalOrdTerm t => (OrdSymbolic (SBVType t) => r) -> r
withSbvOrdTermConstraint @t ((OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool)
-> (OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBV Bool
forall a. OrdSymbolic a => a -> a -> SBV Bool
SBV..<= SBVType t
r
pevalGtOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
pevalGtOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalGtOrdTerm = (Term a -> Term a -> Term Bool) -> Term a -> Term a -> Term Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLtOrdTerm
{-# INLINE pevalGtOrdTerm #-}
pevalGeOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
pevalGeOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalGeOrdTerm = (Term a -> Term a -> Term Bool) -> Term a -> Term a -> Term Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLeOrdTerm
{-# INLINE pevalGeOrdTerm #-}
class PEvalDivModIntegralTerm t where
pevalDivIntegralTerm :: Term t -> Term t -> Term t
pevalModIntegralTerm :: Term t -> Term t -> Term t
pevalQuotIntegralTerm :: Term t -> Term t -> Term t
pevalRemIntegralTerm :: Term t -> Term t -> Term t
withSbvDivModIntegralTermConstraint ::
(((SBV.SDivisible (SBVType t)) => r)) -> r
sbvDivIntegralTerm :: SBVType t -> SBVType t -> SBVType t
sbvDivIntegralTerm SBVType t
l SBVType t
r =
forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sDiv` SBVType t
r
sbvModIntegralTerm :: SBVType t -> SBVType t -> SBVType t
sbvModIntegralTerm SBVType t
l SBVType t
r =
forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sMod` SBVType t
r
sbvQuotIntegralTerm :: SBVType t -> SBVType t -> SBVType t
sbvQuotIntegralTerm SBVType t
l SBVType t
r =
forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sQuot` SBVType t
r
sbvRemIntegralTerm :: SBVType t -> SBVType t -> SBVType t
sbvRemIntegralTerm SBVType t
l SBVType t
r =
forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sRem` SBVType t
r
class (BitCast a b) => PEvalBitCastTerm a b where
pevalBitCastTerm :: Term a -> Term b
sbvBitCast :: SBVType a -> SBVType b
class
(BitCastOr a b) =>
PEvalBitCastOrTerm a b
where
pevalBitCastOrTerm :: Term b -> Term a -> Term b
sbvBitCastOr :: SBVType b -> SBVType a -> SBVType b
class
( SizedBV bv,
forall n. (KnownNat n, 1 <= n) => PEvalNumTerm (bv n),
forall n. (KnownNat n, 1 <= n) => PEvalBitwiseTerm (bv n),
forall n. (KnownNat n, 1 <= n) => FiniteBits (bv n),
forall n. (KnownNat n, 1 <= n) => Num (bv n)
) =>
PEvalBVTerm bv
where
pevalBVConcatTerm ::
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) ->
Term (bv r) ->
Term (bv (l + r))
pevalBVExtendTerm ::
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool ->
proxy r ->
Term (bv l) ->
Term (bv r)
pevalBVSelectTerm ::
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w, ix + w <= n) =>
p ix ->
q w ->
Term (bv n) ->
Term (bv w)
sbvBVConcatTerm ::
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
p1 l ->
p2 r ->
SBVType (bv l) ->
SBVType (bv r) ->
SBVType (bv (l + r))
sbvBVExtendTerm ::
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
p1 l ->
p2 r ->
Bool ->
SBVType (bv l) ->
SBVType (bv r)
sbvBVSelectTerm ::
( KnownNat ix,
KnownNat w,
KnownNat n,
1 <= n,
1 <= w,
ix + w <= n
) =>
p1 ix ->
p2 w ->
p3 n ->
SBVType (bv n) ->
SBVType (bv w)
class (Fractional t) => PEvalFractionalTerm t where
pevalFdivTerm :: Term t -> Term t -> Term t
pevalRecipTerm :: Term t -> Term t
withSbvFractionalTermConstraint ::
(((Fractional (SBVType t)) => r)) ->
r
sbvFdivTerm ::
SBVType t ->
SBVType t ->
SBVType t
sbvFdivTerm SBVType t
l SBVType t
r = forall t r.
PEvalFractionalTerm t =>
(Fractional (SBVType t) => r) -> r
withSbvFractionalTermConstraint @t ((Fractional (SBVType t) => SBVType t) -> SBVType t)
-> (Fractional (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Fractional a => a -> a -> a
/ SBVType t
r
sbvRecipTerm ::
SBVType t ->
SBVType t
sbvRecipTerm SBVType t
l = forall t r.
PEvalFractionalTerm t =>
(Fractional (SBVType t) => r) -> r
withSbvFractionalTermConstraint @t ((Fractional (SBVType t) => SBVType t) -> SBVType t)
-> (Fractional (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Fractional a => a -> a
recip SBVType t
l
data FloatingUnaryOp
= FloatingExp
| FloatingLog
| FloatingSqrt
| FloatingSin
| FloatingCos
| FloatingTan
| FloatingAsin
| FloatingAcos
| FloatingAtan
| FloatingSinh
| FloatingCosh
| FloatingTanh
| FloatingAsinh
| FloatingAcosh
| FloatingAtanh
deriving (FloatingUnaryOp -> FloatingUnaryOp -> Bool
(FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> Eq FloatingUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
== :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c/= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
/= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
Eq, Eq FloatingUnaryOp
Eq FloatingUnaryOp =>
(FloatingUnaryOp -> FloatingUnaryOp -> Ordering)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp)
-> (FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp)
-> Ord FloatingUnaryOp
FloatingUnaryOp -> FloatingUnaryOp -> Bool
FloatingUnaryOp -> FloatingUnaryOp -> Ordering
FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FloatingUnaryOp -> FloatingUnaryOp -> Ordering
compare :: FloatingUnaryOp -> FloatingUnaryOp -> Ordering
$c< :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
< :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c<= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
<= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c> :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
> :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c>= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
>= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$cmax :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
max :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
$cmin :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
min :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
Ord, (forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x)
-> (forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp)
-> Generic FloatingUnaryOp
forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
from :: forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
$cto :: forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
to :: forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
Generic, Eq FloatingUnaryOp
Eq FloatingUnaryOp =>
(Int -> FloatingUnaryOp -> Int)
-> (FloatingUnaryOp -> Int) -> Hashable FloatingUnaryOp
Int -> FloatingUnaryOp -> Int
FloatingUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FloatingUnaryOp -> Int
hashWithSalt :: Int -> FloatingUnaryOp -> Int
$chash :: FloatingUnaryOp -> Int
hash :: FloatingUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp)
-> Lift FloatingUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
$clift :: forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
Lift, FloatingUnaryOp -> ()
(FloatingUnaryOp -> ()) -> NFData FloatingUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FloatingUnaryOp -> ()
rnf :: FloatingUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FloatingUnaryOp)
-> Serial FloatingUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
Serial)
instance Cereal.Serialize FloatingUnaryOp where
put :: Putter FloatingUnaryOp
put = Putter FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize
get :: Get FloatingUnaryOp
get = Get FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize
instance Binary.Binary FloatingUnaryOp where
put :: FloatingUnaryOp -> Put
put = FloatingUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize
get :: Get FloatingUnaryOp
get = Get FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize
instance Show FloatingUnaryOp where
show :: FloatingUnaryOp -> String
show FloatingUnaryOp
FloatingExp = String
"exp"
show FloatingUnaryOp
FloatingLog = String
"log"
show FloatingUnaryOp
FloatingSqrt = String
"sqrt"
show FloatingUnaryOp
FloatingSin = String
"sin"
show FloatingUnaryOp
FloatingCos = String
"cos"
show FloatingUnaryOp
FloatingTan = String
"tan"
show FloatingUnaryOp
FloatingAsin = String
"asin"
show FloatingUnaryOp
FloatingAcos = String
"acos"
show FloatingUnaryOp
FloatingAtan = String
"atan"
show FloatingUnaryOp
FloatingSinh = String
"sinh"
show FloatingUnaryOp
FloatingCosh = String
"cosh"
show FloatingUnaryOp
FloatingTanh = String
"tanh"
show FloatingUnaryOp
FloatingAsinh = String
"asinh"
show FloatingUnaryOp
FloatingAcosh = String
"acosh"
show FloatingUnaryOp
FloatingAtanh = String
"atanh"
class PEvalFPTerm fp where
pevalFPTraitTerm :: (ValidFP eb sb) => FPTrait -> Term (fp eb sb) -> Term Bool
pevalFPUnaryTerm ::
(ValidFP eb sb) =>
FPUnaryOp ->
Term (fp eb sb) ->
Term (fp eb sb)
pevalFPBinaryTerm ::
(ValidFP eb sb) =>
FPBinaryOp ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
pevalFPRoundingUnaryTerm ::
(ValidFP eb sb) =>
FPRoundingUnaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb)
pevalFPRoundingBinaryTerm ::
(ValidFP eb sb) =>
FPRoundingBinaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
pevalFPFMATerm ::
(ValidFP eb sb) =>
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
sbvFPTraitTerm ::
(ValidFP eb sb) => FPTrait -> SBVType (fp eb sb) -> SBVType Bool
sbvFPUnaryTerm ::
(ValidFP eb sb) =>
FPUnaryOp ->
SBVType (fp eb sb) ->
SBVType (fp eb sb)
sbvFPBinaryTerm ::
(ValidFP eb sb) =>
FPBinaryOp ->
SBVType (fp eb sb) ->
SBVType (fp eb sb) ->
SBVType (fp eb sb)
sbvFPRoundingUnaryTerm ::
(ValidFP eb sb) =>
FPRoundingUnaryOp ->
SBVType FPRoundingMode ->
SBVType (fp eb sb) ->
SBVType (fp eb sb)
sbvFPRoundingBinaryTerm ::
(ValidFP eb sb) =>
FPRoundingBinaryOp ->
SBVType FPRoundingMode ->
SBVType (fp eb sb) ->
SBVType (fp eb sb) ->
SBVType (fp eb sb)
sbvFPFMATerm ::
(ValidFP eb sb) =>
SBVType FPRoundingMode ->
SBVType (fp eb sb) ->
SBVType (fp eb sb) ->
SBVType (fp eb sb) ->
SBVType (fp eb sb)
class PEvalFloatingTerm t where
pevalFloatingUnaryTerm :: FloatingUnaryOp -> Term t -> Term t
pevalPowerTerm :: Term t -> Term t -> Term t
withSbvFloatingTermConstraint ::
(((Floating (SBVType t)) => r)) ->
r
sbvPowerTerm ::
SBVType t ->
SBVType t ->
SBVType t
sbvPowerTerm = forall t r. PEvalFloatingTerm t => (Floating (SBVType t) => r) -> r
withSbvFloatingTermConstraint @t Floating (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Floating a => a -> a -> a
(**)
sbvFloatingUnaryTerm ::
FloatingUnaryOp ->
SBVType t ->
SBVType t
sbvFloatingUnaryTerm FloatingUnaryOp
op SBVType t
l =
forall t r. PEvalFloatingTerm t => (Floating (SBVType t) => r) -> r
withSbvFloatingTermConstraint @t ((Floating (SBVType t) => SBVType t) -> SBVType t)
-> (Floating (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$
case FloatingUnaryOp
op of
FloatingUnaryOp
FloatingExp -> SBVType t -> SBVType t
forall a. Floating a => a -> a
exp SBVType t
l
FloatingUnaryOp
FloatingLog -> SBVType t -> SBVType t
forall a. Floating a => a -> a
log SBVType t
l
FloatingUnaryOp
FloatingSqrt -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sqrt SBVType t
l
FloatingUnaryOp
FloatingSin -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sin SBVType t
l
FloatingUnaryOp
FloatingCos -> SBVType t -> SBVType t
forall a. Floating a => a -> a
cos SBVType t
l
FloatingUnaryOp
FloatingTan -> SBVType t -> SBVType t
forall a. Floating a => a -> a
tan SBVType t
l
FloatingUnaryOp
FloatingAsin -> SBVType t -> SBVType t
forall a. Floating a => a -> a
asin SBVType t
l
FloatingUnaryOp
FloatingAcos -> SBVType t -> SBVType t
forall a. Floating a => a -> a
acos SBVType t
l
FloatingUnaryOp
FloatingAtan -> SBVType t -> SBVType t
forall a. Floating a => a -> a
atan SBVType t
l
FloatingUnaryOp
FloatingSinh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sinh SBVType t
l
FloatingUnaryOp
FloatingCosh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
cosh SBVType t
l
FloatingUnaryOp
FloatingTanh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
tanh SBVType t
l
FloatingUnaryOp
FloatingAsinh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
asinh SBVType t
l
FloatingUnaryOp
FloatingAcosh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
acosh SBVType t
l
FloatingUnaryOp
FloatingAtanh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
atanh SBVType t
l
class (Integral a, Num b) => PEvalFromIntegralTerm a b where
pevalFromIntegralTerm :: Term a -> Term b
sbvFromIntegralTerm :: SBVType a -> SBVType b
class PEvalIEEEFPConvertibleTerm a where
pevalFromFPOrTerm ::
(ValidFP eb sb) =>
Term a ->
Term FPRoundingMode ->
Term (FP eb sb) ->
Term a
pevalToFPTerm ::
(ValidFP eb sb) => Term FPRoundingMode -> Term a -> Term (FP eb sb)
sbvFromFPOrTerm ::
(ValidFP eb sb) =>
SBVType a ->
SBVType FPRoundingMode ->
SBVType (FP eb sb) ->
SBVType a
sbvToFPTerm ::
(ValidFP eb sb) =>
SBVType FPRoundingMode ->
SBVType a ->
SBVType (FP eb sb)
data SymbolKind = ConstantKind | AnyKind
class IsSymbolKind (knd :: SymbolKind) where
type SymbolKindConstraint knd :: Type -> Constraint
decideSymbolKind :: Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
withSymbolKindConstraint ::
TypedSymbol knd t ->
((SymbolKindConstraint knd t) => a) ->
a
instance IsSymbolKind 'ConstantKind where
type SymbolKindConstraint 'ConstantKind = SupportedNonFuncPrim
decideSymbolKind :: Either
('ConstantKind :~~: 'ConstantKind) ('ConstantKind :~~: 'AnyKind)
decideSymbolKind = ('ConstantKind :~~: 'ConstantKind)
-> Either
('ConstantKind :~~: 'ConstantKind) ('ConstantKind :~~: 'AnyKind)
forall a b. a -> Either a b
Left 'ConstantKind :~~: 'ConstantKind
forall {k1} (a :: k1). a :~~: a
HRefl
withSymbolKindConstraint :: forall t a.
TypedSymbol 'ConstantKind t
-> (SymbolKindConstraint 'ConstantKind t => a) -> a
withSymbolKindConstraint TypedSymbol 'ConstantKind t
r = TypedSymbol 'ConstantKind t -> (SupportedNonFuncPrim t => a) -> a
forall t a.
TypedSymbol 'ConstantKind t -> (SupportedNonFuncPrim t => a) -> a
withConstantSymbolSupported TypedSymbol 'ConstantKind t
r
instance IsSymbolKind 'AnyKind where
type SymbolKindConstraint 'AnyKind = SupportedPrim
decideSymbolKind :: Either ('AnyKind :~~: 'ConstantKind) ('AnyKind :~~: 'AnyKind)
decideSymbolKind = ('AnyKind :~~: 'AnyKind)
-> Either ('AnyKind :~~: 'ConstantKind) ('AnyKind :~~: 'AnyKind)
forall a b. b -> Either a b
Right 'AnyKind :~~: 'AnyKind
forall {k1} (a :: k1). a :~~: a
HRefl
withSymbolKindConstraint :: forall t a.
TypedSymbol 'AnyKind t
-> (SymbolKindConstraint 'AnyKind t => a) -> a
withSymbolKindConstraint TypedSymbol 'AnyKind t
r = TypedSymbol 'AnyKind t -> (SupportedPrim t => a) -> a
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol 'AnyKind t
r
data TypedSymbol (knd :: SymbolKind) t where
TypedSymbol ::
( SupportedPrim t,
SymbolKindConstraint knd t,
IsSymbolKind knd
) =>
{forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol :: Symbol} ->
TypedSymbol knd t
typedConstantSymbol ::
forall t. (SupportedNonFuncPrim t) => Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol :: forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol = PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
forall t.
PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' PhantomNonFuncDict t
forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
getPhantomNonFuncDict
{-# INLINE typedConstantSymbol #-}
{-# NOINLINE typedConstantSymbol' #-}
typedConstantSymbol' ::
forall t. PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' :: forall t.
PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' PhantomNonFuncDict t
PhantomNonFuncDict Symbol
symbol = Symbol -> TypedSymbol 'ConstantKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
symbol
typedAnySymbol ::
forall t. (SupportedPrim t) => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol :: forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol = PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict
{-# INLINE typedAnySymbol #-}
{-# NOINLINE typedAnySymbol' #-}
typedAnySymbol' ::
forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' :: forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' PhantomDict t
PhantomDict Symbol
symbol = Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
symbol
type TypedConstantSymbol = TypedSymbol 'ConstantKind
type TypedAnySymbol = TypedSymbol 'AnyKind
instance Eq (TypedSymbol knd t) where
TypedSymbol Symbol
x == :: TypedSymbol knd t -> TypedSymbol knd t -> Bool
== TypedSymbol Symbol
y = Symbol
x Symbol -> Symbol -> Bool
forall a. Eq a => a -> a -> Bool
== Symbol
y
instance Ord (TypedSymbol knd t) where
TypedSymbol Symbol
x <= :: TypedSymbol knd t -> TypedSymbol knd t -> Bool
<= TypedSymbol Symbol
y = Symbol
x Symbol -> Symbol -> Bool
forall a. Ord a => a -> a -> Bool
<= Symbol
y
instance Lift (TypedSymbol knd t) where
liftTyped :: forall (m :: * -> *).
Quote m =>
TypedSymbol knd t -> Code m (TypedSymbol knd t)
liftTyped (TypedSymbol Symbol
x) = [||Symbol -> TypedSymbol knd t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
x||]
instance Show (TypedSymbol knd t) where
show :: TypedSymbol knd t -> String
show (TypedSymbol Symbol
symbol) = Symbol -> String
forall a. Show a => a -> String
show Symbol
symbol String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" :: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep t -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @t)
showUntyped :: TypedSymbol knd t -> String
showUntyped :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> String
showUntyped (TypedSymbol Symbol
symbol) = Symbol -> String
forall a. Show a => a -> String
show Symbol
symbol
instance Hashable (TypedSymbol knd t) where
Int
s hashWithSalt :: Int -> TypedSymbol knd t -> Int
`hashWithSalt` TypedSymbol Symbol
x = Int
s Int -> Symbol -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Symbol
x
instance NFData (TypedSymbol knd t) where
rnf :: TypedSymbol knd t -> ()
rnf (TypedSymbol Symbol
str) = Symbol -> ()
forall a. NFData a => a -> ()
rnf Symbol
str
instance
( SupportedPrim t,
SymbolKindConstraint knd t,
IsSymbolKind knd
) =>
IsString (TypedSymbol knd t)
where
fromString :: String -> TypedSymbol knd t
fromString = Symbol -> TypedSymbol knd t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol knd t)
-> (String -> Symbol) -> String -> TypedSymbol knd t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Symbol
forall a. IsString a => String -> a
fromString
withSymbolSupported ::
forall knd t a.
TypedSymbol knd t ->
((SupportedPrim t) => a) ->
a
withSymbolSupported :: forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported (TypedSymbol Symbol
_) SupportedPrim t => a
a = a
SupportedPrim t => a
a
{-# INLINE withSymbolSupported #-}
withConstantSymbolSupported ::
forall t a.
TypedSymbol 'ConstantKind t ->
((SupportedNonFuncPrim t) => a) ->
a
withConstantSymbolSupported :: forall t a.
TypedSymbol 'ConstantKind t -> (SupportedNonFuncPrim t => a) -> a
withConstantSymbolSupported (TypedSymbol Symbol
_) SupportedNonFuncPrim t => a
a = a
SupportedNonFuncPrim t => a
a
{-# INLINE withConstantSymbolSupported #-}
data SomeTypedSymbol knd where
SomeTypedSymbol ::
forall knd t.
TypedSymbol knd t ->
SomeTypedSymbol knd
type SomeTypedConstantSymbol = SomeTypedSymbol 'ConstantKind
type SomeTypedAnySymbol = SomeTypedSymbol 'AnyKind
instance NFData (SomeTypedSymbol knd) where
rnf :: SomeTypedSymbol knd -> ()
rnf (SomeTypedSymbol TypedSymbol knd t
s) = TypedSymbol knd t -> ()
forall a. NFData a => a -> ()
rnf TypedSymbol knd t
s
{-# INLINE rnf #-}
instance Lift (SomeTypedSymbol knd) where
liftTyped :: forall (m :: * -> *).
Quote m =>
SomeTypedSymbol knd -> Code m (SomeTypedSymbol knd)
liftTyped (SomeTypedSymbol TypedSymbol knd t
s) = [||TypedSymbol knd t -> SomeTypedSymbol knd
forall (knd :: SymbolKind) bv.
TypedSymbol knd bv -> SomeTypedSymbol knd
SomeTypedSymbol TypedSymbol knd t
s||]
instance Eq (SomeTypedSymbol knd) where
(SomeTypedSymbol (TypedSymbol knd t
s1 :: TypedSymbol knd a))
== :: SomeTypedSymbol knd -> SomeTypedSymbol knd -> Bool
== (SomeTypedSymbol (TypedSymbol knd t
s2 :: TypedSymbol knd b)) =
TypedSymbol knd t -> (SupportedPrim t => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol knd t
s1 ((SupportedPrim t => Bool) -> Bool)
-> (SupportedPrim t => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
TypedSymbol knd t -> (SupportedPrim t => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol knd t
s2 ((SupportedPrim t => Bool) -> Bool)
-> (SupportedPrim t => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
case TypeRep t -> TypeRep t -> Maybe (t :~~: t)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @a) (forall t. SupportedPrim t => TypeRep t
primTypeRep @b) of
Just t :~~: t
HRefl -> TypedSymbol knd t
s1 TypedSymbol knd t -> TypedSymbol knd t -> Bool
forall a. Eq a => a -> a -> Bool
== TypedSymbol knd t
TypedSymbol knd t
s2
Maybe (t :~~: t)
_ -> Bool
False
{-# INLINE (==) #-}
instance Ord (SomeTypedSymbol knd) where
(SomeTypedSymbol (TypedSymbol knd t
s1 :: TypedSymbol knd a))
<= :: SomeTypedSymbol knd -> SomeTypedSymbol knd -> Bool
<= (SomeTypedSymbol (TypedSymbol knd t
s2 :: TypedSymbol knd b)) =
TypedSymbol knd t -> (SupportedPrim t => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol knd t
s1 ((SupportedPrim t => Bool) -> Bool)
-> (SupportedPrim t => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
TypedSymbol knd t -> (SupportedPrim t => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol knd t
s2 ((SupportedPrim t => Bool) -> Bool)
-> (SupportedPrim t => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
let t1 :: TypeRep t
t1 = forall t. SupportedPrim t => TypeRep t
primTypeRep @a
t2 :: TypeRep t
t2 = forall t. SupportedPrim t => TypeRep t
primTypeRep @b
in TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep TypeRep t
t1 SomeTypeRep -> SomeTypeRep -> Bool
forall a. Ord a => a -> a -> Bool
< TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep TypeRep t
t2
Bool -> Bool -> Bool
|| ( case TypeRep t -> TypeRep t -> Maybe (t :~~: t)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep TypeRep t
t1 TypeRep t
t2 of
Just t :~~: t
HRefl -> TypedSymbol knd t
s1 TypedSymbol knd t -> TypedSymbol knd t -> Bool
forall a. Ord a => a -> a -> Bool
<= TypedSymbol knd t
TypedSymbol knd t
s2
Maybe (t :~~: t)
_ -> Bool
False
)
instance Hashable (SomeTypedSymbol knd) where
hashWithSalt :: Int -> SomeTypedSymbol knd -> Int
hashWithSalt Int
s (SomeTypedSymbol TypedSymbol knd t
s1) = Int
s Int -> TypedSymbol knd t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol knd t
s1
{-# INLINE hashWithSalt #-}
instance Show (SomeTypedSymbol knd) where
show :: SomeTypedSymbol knd -> String
show (SomeTypedSymbol TypedSymbol knd t
s) = TypedSymbol knd t -> String
forall a. Show a => a -> String
show TypedSymbol knd t
s
someTypedSymbol :: forall knd t. TypedSymbol knd t -> SomeTypedSymbol knd
someTypedSymbol :: forall (knd :: SymbolKind) bv.
TypedSymbol knd bv -> SomeTypedSymbol knd
someTypedSymbol s :: TypedSymbol knd t
s@(TypedSymbol Symbol
_) = TypedSymbol knd t -> SomeTypedSymbol knd
forall (knd :: SymbolKind) bv.
TypedSymbol knd bv -> SomeTypedSymbol knd
SomeTypedSymbol TypedSymbol knd t
s
{-# INLINE someTypedSymbol #-}
data FPTrait
= FPIsNaN
| FPIsPositive
| FPIsNegative
| FPIsPositiveInfinite
| FPIsNegativeInfinite
| FPIsInfinite
| FPIsPositiveZero
| FPIsNegativeZero
| FPIsZero
| FPIsNormal
| FPIsSubnormal
| FPIsPoint
deriving (FPTrait -> FPTrait -> Bool
(FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool) -> Eq FPTrait
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPTrait -> FPTrait -> Bool
== :: FPTrait -> FPTrait -> Bool
$c/= :: FPTrait -> FPTrait -> Bool
/= :: FPTrait -> FPTrait -> Bool
Eq, Eq FPTrait
Eq FPTrait =>
(FPTrait -> FPTrait -> Ordering)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> FPTrait)
-> (FPTrait -> FPTrait -> FPTrait)
-> Ord FPTrait
FPTrait -> FPTrait -> Bool
FPTrait -> FPTrait -> Ordering
FPTrait -> FPTrait -> FPTrait
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPTrait -> FPTrait -> Ordering
compare :: FPTrait -> FPTrait -> Ordering
$c< :: FPTrait -> FPTrait -> Bool
< :: FPTrait -> FPTrait -> Bool
$c<= :: FPTrait -> FPTrait -> Bool
<= :: FPTrait -> FPTrait -> Bool
$c> :: FPTrait -> FPTrait -> Bool
> :: FPTrait -> FPTrait -> Bool
$c>= :: FPTrait -> FPTrait -> Bool
>= :: FPTrait -> FPTrait -> Bool
$cmax :: FPTrait -> FPTrait -> FPTrait
max :: FPTrait -> FPTrait -> FPTrait
$cmin :: FPTrait -> FPTrait -> FPTrait
min :: FPTrait -> FPTrait -> FPTrait
Ord, (forall x. FPTrait -> Rep FPTrait x)
-> (forall x. Rep FPTrait x -> FPTrait) -> Generic FPTrait
forall x. Rep FPTrait x -> FPTrait
forall x. FPTrait -> Rep FPTrait x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPTrait -> Rep FPTrait x
from :: forall x. FPTrait -> Rep FPTrait x
$cto :: forall x. Rep FPTrait x -> FPTrait
to :: forall x. Rep FPTrait x -> FPTrait
Generic, Eq FPTrait
Eq FPTrait =>
(Int -> FPTrait -> Int) -> (FPTrait -> Int) -> Hashable FPTrait
Int -> FPTrait -> Int
FPTrait -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPTrait -> Int
hashWithSalt :: Int -> FPTrait -> Int
$chash :: FPTrait -> Int
hash :: FPTrait -> Int
Hashable, (forall (m :: * -> *). Quote m => FPTrait -> m Exp)
-> (forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait)
-> Lift FPTrait
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPTrait -> m Exp
forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
$clift :: forall (m :: * -> *). Quote m => FPTrait -> m Exp
lift :: forall (m :: * -> *). Quote m => FPTrait -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
liftTyped :: forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
Lift, FPTrait -> ()
(FPTrait -> ()) -> NFData FPTrait
forall a. (a -> ()) -> NFData a
$crnf :: FPTrait -> ()
rnf :: FPTrait -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPTrait -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPTrait)
-> Serial FPTrait
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPTrait
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPTrait -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPTrait
deserialize :: forall (m :: * -> *). MonadGet m => m FPTrait
Serial)
instance Cereal.Serialize FPTrait where
put :: Putter FPTrait
put = Putter FPTrait
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize
get :: Get FPTrait
get = Get FPTrait
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPTrait
deserialize
instance Binary.Binary FPTrait where
put :: FPTrait -> Put
put = FPTrait -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize
get :: Get FPTrait
get = Get FPTrait
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPTrait
deserialize
instance Show FPTrait where
show :: FPTrait -> String
show FPTrait
FPIsNaN = String
"is_nan"
show FPTrait
FPIsPositive = String
"is_pos"
show FPTrait
FPIsNegative = String
"is_neg"
show FPTrait
FPIsPositiveInfinite = String
"is_pos_inf"
show FPTrait
FPIsNegativeInfinite = String
"is_neg_inf"
show FPTrait
FPIsInfinite = String
"is_inf"
show FPTrait
FPIsPositiveZero = String
"is_pos_zero"
show FPTrait
FPIsNegativeZero = String
"is_neg_zero"
show FPTrait
FPIsZero = String
"is_zero"
show FPTrait
FPIsNormal = String
"is_normal"
show FPTrait
FPIsSubnormal = String
"is_subnormal"
show FPTrait
FPIsPoint = String
"is_point"
data FPUnaryOp = FPAbs | FPNeg
deriving (FPUnaryOp -> FPUnaryOp -> Bool
(FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool) -> Eq FPUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPUnaryOp -> FPUnaryOp -> Bool
== :: FPUnaryOp -> FPUnaryOp -> Bool
$c/= :: FPUnaryOp -> FPUnaryOp -> Bool
/= :: FPUnaryOp -> FPUnaryOp -> Bool
Eq, Eq FPUnaryOp
Eq FPUnaryOp =>
(FPUnaryOp -> FPUnaryOp -> Ordering)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> FPUnaryOp)
-> (FPUnaryOp -> FPUnaryOp -> FPUnaryOp)
-> Ord FPUnaryOp
FPUnaryOp -> FPUnaryOp -> Bool
FPUnaryOp -> FPUnaryOp -> Ordering
FPUnaryOp -> FPUnaryOp -> FPUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPUnaryOp -> FPUnaryOp -> Ordering
compare :: FPUnaryOp -> FPUnaryOp -> Ordering
$c< :: FPUnaryOp -> FPUnaryOp -> Bool
< :: FPUnaryOp -> FPUnaryOp -> Bool
$c<= :: FPUnaryOp -> FPUnaryOp -> Bool
<= :: FPUnaryOp -> FPUnaryOp -> Bool
$c> :: FPUnaryOp -> FPUnaryOp -> Bool
> :: FPUnaryOp -> FPUnaryOp -> Bool
$c>= :: FPUnaryOp -> FPUnaryOp -> Bool
>= :: FPUnaryOp -> FPUnaryOp -> Bool
$cmax :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
max :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
$cmin :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
min :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
Ord, (forall x. FPUnaryOp -> Rep FPUnaryOp x)
-> (forall x. Rep FPUnaryOp x -> FPUnaryOp) -> Generic FPUnaryOp
forall x. Rep FPUnaryOp x -> FPUnaryOp
forall x. FPUnaryOp -> Rep FPUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPUnaryOp -> Rep FPUnaryOp x
from :: forall x. FPUnaryOp -> Rep FPUnaryOp x
$cto :: forall x. Rep FPUnaryOp x -> FPUnaryOp
to :: forall x. Rep FPUnaryOp x -> FPUnaryOp
Generic, Eq FPUnaryOp
Eq FPUnaryOp =>
(Int -> FPUnaryOp -> Int)
-> (FPUnaryOp -> Int) -> Hashable FPUnaryOp
Int -> FPUnaryOp -> Int
FPUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPUnaryOp -> Int
hashWithSalt :: Int -> FPUnaryOp -> Int
$chash :: FPUnaryOp -> Int
hash :: FPUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp)
-> (forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp)
-> Lift FPUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
$clift :: forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
liftTyped :: forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
Lift, FPUnaryOp -> ()
(FPUnaryOp -> ()) -> NFData FPUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPUnaryOp -> ()
rnf :: FPUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPUnaryOp)
-> Serial FPUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPUnaryOp
Serial)
instance Cereal.Serialize FPUnaryOp where
put :: Putter FPUnaryOp
put = Putter FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize
get :: Get FPUnaryOp
get = Get FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize
instance Binary.Binary FPUnaryOp where
put :: FPUnaryOp -> Put
put = FPUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize
get :: Get FPUnaryOp
get = Get FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize
instance Show FPUnaryOp where
show :: FPUnaryOp -> String
show FPUnaryOp
FPAbs = String
"fp.abs"
show FPUnaryOp
FPNeg = String
"fp.neg"
data FPBinaryOp
= FPRem
| FPMinimum
| FPMinimumNumber
| FPMaximum
| FPMaximumNumber
deriving (FPBinaryOp -> FPBinaryOp -> Bool
(FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool) -> Eq FPBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPBinaryOp -> FPBinaryOp -> Bool
== :: FPBinaryOp -> FPBinaryOp -> Bool
$c/= :: FPBinaryOp -> FPBinaryOp -> Bool
/= :: FPBinaryOp -> FPBinaryOp -> Bool
Eq, Eq FPBinaryOp
Eq FPBinaryOp =>
(FPBinaryOp -> FPBinaryOp -> Ordering)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> FPBinaryOp)
-> (FPBinaryOp -> FPBinaryOp -> FPBinaryOp)
-> Ord FPBinaryOp
FPBinaryOp -> FPBinaryOp -> Bool
FPBinaryOp -> FPBinaryOp -> Ordering
FPBinaryOp -> FPBinaryOp -> FPBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPBinaryOp -> FPBinaryOp -> Ordering
compare :: FPBinaryOp -> FPBinaryOp -> Ordering
$c< :: FPBinaryOp -> FPBinaryOp -> Bool
< :: FPBinaryOp -> FPBinaryOp -> Bool
$c<= :: FPBinaryOp -> FPBinaryOp -> Bool
<= :: FPBinaryOp -> FPBinaryOp -> Bool
$c> :: FPBinaryOp -> FPBinaryOp -> Bool
> :: FPBinaryOp -> FPBinaryOp -> Bool
$c>= :: FPBinaryOp -> FPBinaryOp -> Bool
>= :: FPBinaryOp -> FPBinaryOp -> Bool
$cmax :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
max :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
$cmin :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
min :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
Ord, (forall x. FPBinaryOp -> Rep FPBinaryOp x)
-> (forall x. Rep FPBinaryOp x -> FPBinaryOp) -> Generic FPBinaryOp
forall x. Rep FPBinaryOp x -> FPBinaryOp
forall x. FPBinaryOp -> Rep FPBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPBinaryOp -> Rep FPBinaryOp x
from :: forall x. FPBinaryOp -> Rep FPBinaryOp x
$cto :: forall x. Rep FPBinaryOp x -> FPBinaryOp
to :: forall x. Rep FPBinaryOp x -> FPBinaryOp
Generic, Eq FPBinaryOp
Eq FPBinaryOp =>
(Int -> FPBinaryOp -> Int)
-> (FPBinaryOp -> Int) -> Hashable FPBinaryOp
Int -> FPBinaryOp -> Int
FPBinaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPBinaryOp -> Int
hashWithSalt :: Int -> FPBinaryOp -> Int
$chash :: FPBinaryOp -> Int
hash :: FPBinaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
FPBinaryOp -> Code m FPBinaryOp)
-> Lift FPBinaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
$clift :: forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
liftTyped :: forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
Lift, FPBinaryOp -> ()
(FPBinaryOp -> ()) -> NFData FPBinaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPBinaryOp -> ()
rnf :: FPBinaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPBinaryOp)
-> Serial FPBinaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPBinaryOp
Serial)
instance Cereal.Serialize FPBinaryOp where
put :: Putter FPBinaryOp
put = Putter FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize
get :: Get FPBinaryOp
get = Get FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize
instance Binary.Binary FPBinaryOp where
put :: FPBinaryOp -> Put
put = FPBinaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize
get :: Get FPBinaryOp
get = Get FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize
instance Show FPBinaryOp where
show :: FPBinaryOp -> String
show FPBinaryOp
FPRem = String
"fp.rem"
show FPBinaryOp
FPMinimum = String
"fp.minimum"
show FPBinaryOp
FPMinimumNumber = String
"fp.minimumNumber"
show FPBinaryOp
FPMaximum = String
"fp.maximum"
show FPBinaryOp
FPMaximumNumber = String
"fp.maximumNumber"
data FPRoundingUnaryOp = FPSqrt | FPRoundToIntegral
deriving (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
(FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> Eq FPRoundingUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
== :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c/= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
/= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
Eq, Eq FPRoundingUnaryOp
Eq FPRoundingUnaryOp =>
(FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp)
-> Ord FPRoundingUnaryOp
FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
compare :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
$c< :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
< :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c<= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
<= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c> :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
> :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c>= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
>= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$cmax :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
max :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
$cmin :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
min :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
Ord, (forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x)
-> (forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp)
-> Generic FPRoundingUnaryOp
forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
from :: forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
$cto :: forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
to :: forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
Generic, Eq FPRoundingUnaryOp
Eq FPRoundingUnaryOp =>
(Int -> FPRoundingUnaryOp -> Int)
-> (FPRoundingUnaryOp -> Int) -> Hashable FPRoundingUnaryOp
Int -> FPRoundingUnaryOp -> Int
FPRoundingUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPRoundingUnaryOp -> Int
hashWithSalt :: Int -> FPRoundingUnaryOp -> Int
$chash :: FPRoundingUnaryOp -> Int
hash :: FPRoundingUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp)
-> Lift FPRoundingUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
$clift :: forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
Lift, FPRoundingUnaryOp -> ()
(FPRoundingUnaryOp -> ()) -> NFData FPRoundingUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPRoundingUnaryOp -> ()
rnf :: FPRoundingUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp)
-> Serial FPRoundingUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
Serial)
instance Cereal.Serialize FPRoundingUnaryOp where
put :: Putter FPRoundingUnaryOp
put = Putter FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize
get :: Get FPRoundingUnaryOp
get = Get FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize
instance Binary.Binary FPRoundingUnaryOp where
put :: FPRoundingUnaryOp -> Put
put = FPRoundingUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize
get :: Get FPRoundingUnaryOp
get = Get FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize
instance Show FPRoundingUnaryOp where
show :: FPRoundingUnaryOp -> String
show FPRoundingUnaryOp
FPSqrt = String
"fp.sqrt"
show FPRoundingUnaryOp
FPRoundToIntegral = String
"fp.roundToIntegral"
data FPRoundingBinaryOp = FPAdd | FPSub | FPMul | FPDiv
deriving (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
(FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> Eq FPRoundingBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
== :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c/= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
/= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
Eq, Eq FPRoundingBinaryOp
Eq FPRoundingBinaryOp =>
(FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp)
-> Ord FPRoundingBinaryOp
FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
compare :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
$c< :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
< :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c<= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
<= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c> :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
> :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c>= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
>= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$cmax :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
max :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
$cmin :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
min :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
Ord, (forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x)
-> (forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp)
-> Generic FPRoundingBinaryOp
forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
from :: forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
$cto :: forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
to :: forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
Generic, Eq FPRoundingBinaryOp
Eq FPRoundingBinaryOp =>
(Int -> FPRoundingBinaryOp -> Int)
-> (FPRoundingBinaryOp -> Int) -> Hashable FPRoundingBinaryOp
Int -> FPRoundingBinaryOp -> Int
FPRoundingBinaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPRoundingBinaryOp -> Int
hashWithSalt :: Int -> FPRoundingBinaryOp -> Int
$chash :: FPRoundingBinaryOp -> Int
hash :: FPRoundingBinaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp)
-> (forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp)
-> Lift FPRoundingBinaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
$clift :: forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
Lift, FPRoundingBinaryOp -> ()
(FPRoundingBinaryOp -> ()) -> NFData FPRoundingBinaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPRoundingBinaryOp -> ()
rnf :: FPRoundingBinaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp)
-> Serial FPRoundingBinaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
Serial)
instance Cereal.Serialize FPRoundingBinaryOp where
put :: Putter FPRoundingBinaryOp
put = Putter FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize
get :: Get FPRoundingBinaryOp
get = Get FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize
instance Binary.Binary FPRoundingBinaryOp where
put :: FPRoundingBinaryOp -> Put
put = FPRoundingBinaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize
get :: Get FPRoundingBinaryOp
get = Get FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize
instance Show FPRoundingBinaryOp where
show :: FPRoundingBinaryOp -> String
show FPRoundingBinaryOp
FPAdd = String
"fp.add"
show FPRoundingBinaryOp
FPSub = String
"fp.sub"
show FPRoundingBinaryOp
FPMul = String
"fp.mul"
show FPRoundingBinaryOp
FPDiv = String
"fp.div"
instance NFData CachedInfo where
rnf :: CachedInfo -> ()
rnf (CachedInfo WeakThreadId
tid Digest
digest Digest
id StableName Any
stableIdent) =
WeakThreadId -> ()
forall a. NFData a => a -> ()
rnf WeakThreadId
tid () -> () -> ()
forall a b. a -> b -> b
`seq` Digest -> ()
forall a. NFData a => a -> ()
rnf Digest
digest () -> () -> ()
forall a b. a -> b -> b
`seq` Digest -> ()
forall a. NFData a => a -> ()
rnf Digest
id () -> () -> ()
forall a b. a -> b -> b
`seq` StableName Any -> ()
forall a. NFData a => a -> ()
rnf StableName Any
stableIdent
data Term t where
ConTerm' ::
(SupportedPrim t) =>
{-# UNPACK #-} !CachedInfo ->
!t ->
Term t
SymTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(TypedSymbol 'AnyKind t) ->
Term t
ForallTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(TypedSymbol 'ConstantKind t) ->
!(Term Bool) ->
Term Bool
ExistsTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(TypedSymbol 'ConstantKind t) ->
!(Term Bool) ->
Term Bool
NotTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(Term Bool) ->
Term Bool
OrTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(Term Bool) ->
!(Term Bool) ->
!(HS.HashSet (Term Bool)) ->
Term Bool
AndTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(Term Bool) ->
!(Term Bool) ->
!(HS.HashSet (Term Bool)) ->
Term Bool
EqTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term Bool
DistinctTerm' ::
{-# UNPACK #-} !CachedInfo ->
!(NonEmpty (Term t)) ->
Term Bool
ITETerm' ::
(SupportedPrim t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term Bool) ->
!(Term t) ->
!(Term t) ->
Term t
AddNumTerm' ::
(SupportedPrim t, PEvalNumTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
NegNumTerm' ::
(SupportedPrim t, PEvalNumTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
Term t
MulNumTerm' ::
(SupportedPrim t, PEvalNumTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
AbsNumTerm' ::
(SupportedPrim t, PEvalNumTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
Term t
SignumNumTerm' ::
(SupportedPrim t, PEvalNumTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
Term t
LtOrdTerm' ::
(SupportedPrim t, PEvalOrdTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term Bool
LeOrdTerm' ::
(SupportedPrim t, PEvalOrdTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term Bool
AndBitsTerm' ::
(SupportedPrim t, PEvalBitwiseTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
OrBitsTerm' ::
(SupportedPrim t, PEvalBitwiseTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
XorBitsTerm' ::
(SupportedPrim t, PEvalBitwiseTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
ComplementBitsTerm' ::
(SupportedPrim t, PEvalBitwiseTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
Term t
ShiftLeftTerm' ::
(SupportedPrim t, PEvalShiftTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
ShiftRightTerm' ::
(SupportedPrim t, PEvalShiftTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
RotateLeftTerm' ::
(SupportedPrim t, PEvalRotateTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
RotateRightTerm' ::
(SupportedPrim t, PEvalRotateTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
BitCastTerm' ::
(SupportedPrim b, PEvalBitCastTerm a b) =>
{-# UNPACK #-} !CachedInfo ->
!(Term a) ->
Term b
BitCastOrTerm' ::
(SupportedPrim b, PEvalBitCastOrTerm a b) =>
{-# UNPACK #-} !CachedInfo ->
!(Term b) ->
!(Term a) ->
Term b
BVConcatTerm' ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r,
SupportedPrim (bv (l + r))
) =>
{-# UNPACK #-} !CachedInfo ->
!(Term (bv l)) ->
!(Term (bv r)) ->
Term (bv (l + r))
BVSelectTerm' ::
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
SupportedPrim (bv w)
) =>
{-# UNPACK #-} !CachedInfo ->
!(Proxy ix) ->
!(Proxy w) ->
!(Term (bv n)) ->
Term (bv w)
BVExtendTerm' ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
{-# UNPACK #-} !CachedInfo ->
!Bool ->
!(Proxy r) ->
!(Term (bv l)) ->
Term (bv r)
ApplyTerm' ::
(PEvalApplyTerm f a b, SupportedPrim b) =>
{-# UNPACK #-} !CachedInfo ->
!(Term f) ->
!(Term a) ->
Term b
DivIntegralTerm' ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
ModIntegralTerm' ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
QuotIntegralTerm' ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
RemIntegralTerm' ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
FPTraitTerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!FPTrait ->
!(Term (fp eb sb)) ->
Term Bool
FdivTerm' ::
(SupportedPrim t, PEvalFractionalTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
RecipTerm' ::
(SupportedPrim t, PEvalFractionalTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
Term t
FloatingUnaryTerm' ::
(SupportedPrim t, PEvalFloatingTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!FloatingUnaryOp ->
!(Term t) ->
Term t
PowerTerm' ::
(SupportedPrim t, PEvalFloatingTerm t) =>
{-# UNPACK #-} !CachedInfo ->
!(Term t) ->
!(Term t) ->
Term t
FPUnaryTerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!FPUnaryOp ->
!(Term (fp eb sb)) ->
Term (fp eb sb)
FPBinaryTerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!FPBinaryOp ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
Term (fp eb sb)
FPRoundingUnaryTerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!FPRoundingUnaryOp ->
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
Term (fp eb sb)
FPRoundingBinaryTerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!FPRoundingBinaryOp ->
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
Term (fp eb sb)
FPFMATerm' ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
{-# UNPACK #-} !CachedInfo ->
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
Term (fp eb sb)
FromIntegralTerm' ::
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
{-# UNPACK #-} !CachedInfo ->
!(Term a) ->
Term b
FromFPOrTerm' ::
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim a
) =>
{-# UNPACK #-} !CachedInfo ->
!(Term a) ->
!(Term FPRoundingMode) ->
!(Term (FP eb sb)) ->
Term a
ToFPTerm' ::
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim (FP eb sb)
) =>
{-# UNPACK #-} !CachedInfo ->
!(Term FPRoundingMode) ->
!(Term a) ->
Proxy eb ->
Proxy sb ->
Term (FP eb sb)
data SupportedPrimEvidence t where
SupportedPrimEvidence :: (SupportedPrim t) => SupportedPrimEvidence t
pattern SupportedTerm :: forall t. () => (SupportedPrim t) => Term t
pattern $mSupportedTerm :: forall {r} {t}.
Term t -> (SupportedPrim t => r) -> ((# #) -> r) -> r
SupportedTerm <-
( ( \Term t
v ->
Term t
-> ((SupportedPrim t, Typeable t) =>
Maybe (SupportedPrimEvidence t))
-> Maybe (SupportedPrimEvidence t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
v (((SupportedPrim t, Typeable t) => Maybe (SupportedPrimEvidence t))
-> Maybe (SupportedPrimEvidence t))
-> ((SupportedPrim t, Typeable t) =>
Maybe (SupportedPrimEvidence t))
-> Maybe (SupportedPrimEvidence t)
forall a b. (a -> b) -> a -> b
$
SupportedPrimEvidence t -> Maybe (SupportedPrimEvidence t)
forall a. a -> Maybe a
Just (forall t. SupportedPrim t => SupportedPrimEvidence t
SupportedPrimEvidence @t)
) ->
Just SupportedPrimEvidence
)
#if MIN_VERSION_base(4, 16, 4)
{-# COMPLETE SupportedTerm #-}
{-# INLINE SupportedTerm #-}
#endif
castTerm :: forall a b. (Typeable b) => Term a -> Maybe (Term b)
castTerm :: forall a b. Typeable b => Term a -> Maybe (Term b)
castTerm t :: Term a
t@Term a
SupportedTerm = Term a -> Maybe (Term b)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast Term a
t
{-# INLINE castTerm #-}
data SupportedTypedSymbolEvidence (k :: SymbolKind) t where
SupportedTypedSymbolEvidence ::
forall k t.
(SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k) =>
SupportedTypedSymbolEvidence k t
supportedTypedSymbolViewPat ::
TypedSymbol k t -> Maybe (SupportedTypedSymbolEvidence k t)
supportedTypedSymbolViewPat :: forall (k :: SymbolKind) t.
TypedSymbol k t -> Maybe (SupportedTypedSymbolEvidence k t)
supportedTypedSymbolViewPat (TypedSymbol Symbol
_) = SupportedTypedSymbolEvidence k t
-> Maybe (SupportedTypedSymbolEvidence k t)
forall a. a -> Maybe a
Just SupportedTypedSymbolEvidence k t
forall (k :: SymbolKind) t.
(SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k) =>
SupportedTypedSymbolEvidence k t
SupportedTypedSymbolEvidence
pattern SupportedTypedSymbol ::
forall (k :: SymbolKind) t.
() =>
(SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k) =>
TypedSymbol k t
pattern $mSupportedTypedSymbol :: forall {r} {k :: SymbolKind} {t}.
TypedSymbol k t
-> ((SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k) =>
r)
-> ((# #) -> r)
-> r
SupportedTypedSymbol <-
(supportedTypedSymbolViewPat -> Just SupportedTypedSymbolEvidence)
#if MIN_VERSION_base(4, 16, 4)
{-# COMPLETE SupportedTypedSymbol #-}
{-# INLINE SupportedTypedSymbol #-}
#endif
data SupportedConstantTypedSymbolEvidence k t where
SupportedConstantTypedSymbolEvidence ::
forall k t.
( SupportedPrim t,
SymbolKindConstraint k t,
IsSymbolKind k,
k ~ 'ConstantKind
) =>
SupportedConstantTypedSymbolEvidence k t
supportedConstantTypedSymbolViewPat ::
forall k t.
TypedSymbol k t ->
Maybe (SupportedConstantTypedSymbolEvidence k t)
supportedConstantTypedSymbolViewPat :: forall (k :: SymbolKind) t.
TypedSymbol k t -> Maybe (SupportedConstantTypedSymbolEvidence k t)
supportedConstantTypedSymbolViewPat (TypedSymbol Symbol
_) =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @k of
Left k :~~: 'ConstantKind
HRefl -> SupportedConstantTypedSymbolEvidence k t
-> Maybe (SupportedConstantTypedSymbolEvidence k t)
forall a. a -> Maybe a
Just SupportedConstantTypedSymbolEvidence k t
forall (k :: SymbolKind) t.
(SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k,
k ~ 'ConstantKind) =>
SupportedConstantTypedSymbolEvidence k t
SupportedConstantTypedSymbolEvidence
Right k :~~: 'AnyKind
_ -> Maybe (SupportedConstantTypedSymbolEvidence k t)
forall a. Maybe a
Nothing
pattern SupportedConstantTypedSymbol ::
forall k t.
() =>
( SupportedPrim t,
SymbolKindConstraint k t,
IsSymbolKind k,
k ~ 'ConstantKind
) =>
TypedSymbol k t
pattern $mSupportedConstantTypedSymbol :: forall {r} {k :: SymbolKind} {t}.
TypedSymbol k t
-> ((SupportedPrim t, SymbolKindConstraint k t, IsSymbolKind k,
k ~ 'ConstantKind) =>
r)
-> ((# #) -> r)
-> r
SupportedConstantTypedSymbol <-
( supportedConstantTypedSymbolViewPat ->
Just SupportedConstantTypedSymbolEvidence
)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE SupportedConstantTypedSymbol #-}
#endif
pattern ConTerm :: forall t. () => (SupportedPrim t) => t -> Term t
pattern $mConTerm :: forall {r} {t}.
Term t -> (SupportedPrim t => t -> r) -> ((# #) -> r) -> r
$bConTerm :: forall t. SupportedPrim t => t -> Term t
ConTerm t <- (ConTerm' _ t)
where
ConTerm = t -> Term t
forall t. SupportedPrim t => t -> Term t
conTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ConTerm #-}
#endif
pattern SymTerm ::
forall t. () => (SupportedPrim t) => TypedSymbol 'AnyKind t -> Term t
pattern $mSymTerm :: forall {r} {t}.
Term t
-> (SupportedPrim t => TypedSymbol 'AnyKind t -> r)
-> ((# #) -> r)
-> r
$bSymTerm :: forall t. SupportedPrim t => TypedSymbol 'AnyKind t -> Term t
SymTerm t <- (SymTerm' _ t@SupportedTypedSymbol)
where
SymTerm = TypedSymbol 'AnyKind t -> Term t
forall (knd :: SymbolKind) t. TypedSymbol knd t -> Term t
symTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE SymTerm #-}
#endif
pattern ForallTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t ->
Term Bool ->
Term r
pattern $mForallTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t -> Term Bool -> r)
-> ((# #) -> r)
-> r
$bForallTerm :: forall r t.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t -> Term Bool -> Term r
ForallTerm sym body <-
(ForallTerm' _ sym@SupportedConstantTypedSymbol body)
where
ForallTerm = TypedSymbol 'ConstantKind t -> Term Bool -> Term r
TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forallTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ForallTerm #-}
#endif
pattern ExistsTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t ->
Term Bool ->
Term r
pattern $mExistsTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t -> Term Bool -> r)
-> ((# #) -> r)
-> r
$bExistsTerm :: forall r t.
(r ~ Bool, SupportedNonFuncPrim t) =>
TypedSymbol 'ConstantKind t -> Term Bool -> Term r
ExistsTerm sym body <-
(ExistsTerm' _ sym@SupportedConstantTypedSymbol body)
where
ExistsTerm = TypedSymbol 'ConstantKind t -> Term Bool -> Term r
TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
existsTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ExistsTerm #-}
#endif
pattern NotTerm :: forall r. () => (r ~ Bool) => Term Bool -> Term r
pattern $mNotTerm :: forall {r} {r}.
Term r -> ((r ~ Bool) => Term Bool -> r) -> ((# #) -> r) -> r
$bNotTerm :: forall r. (r ~ Bool) => Term Bool -> Term r
NotTerm body <- (NotTerm' _ body)
where
NotTerm = Term Bool -> Term r
Term Bool -> Term Bool
pevalNotTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE NotTerm #-}
#endif
pattern OrTerm :: forall r. () => (r ~ Bool) => Term Bool -> Term Bool -> Term r
pattern $mOrTerm :: forall {r} {r}.
Term r
-> ((r ~ Bool) => Term Bool -> Term Bool -> r) -> ((# #) -> r) -> r
$bOrTerm :: forall r. (r ~ Bool) => Term Bool -> Term Bool -> Term r
OrTerm l r <- (OrTerm' _ l r _)
where
OrTerm = Term Bool -> Term Bool -> Term r
Term Bool -> Term Bool -> Term Bool
pevalOrTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE OrTerm #-}
#endif
pattern OrTermAll ::
forall r.
() =>
(r ~ Bool) =>
Term Bool -> Term Bool -> HS.HashSet (Term Bool) -> Term r
pattern $mOrTermAll :: forall {r} {r}.
Term r
-> ((r ~ Bool) =>
Term Bool -> Term Bool -> HashSet (Term Bool) -> r)
-> ((# #) -> r)
-> r
OrTermAll l r s <- (OrTerm' _ l r s)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE OrTermAll #-}
#endif
pattern AndTerm :: forall r. () => (r ~ Bool) => Term Bool -> Term Bool -> Term r
pattern $mAndTerm :: forall {r} {r}.
Term r
-> ((r ~ Bool) => Term Bool -> Term Bool -> r) -> ((# #) -> r) -> r
$bAndTerm :: forall r. (r ~ Bool) => Term Bool -> Term Bool -> Term r
AndTerm l r <- (AndTerm' _ l r _)
where
AndTerm = Term Bool -> Term Bool -> Term r
Term Bool -> Term Bool -> Term Bool
pevalAndTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE AndTerm #-}
#endif
pattern AndTermAll ::
forall r.
() =>
(r ~ Bool) =>
Term Bool -> Term Bool -> HS.HashSet (Term Bool) -> Term r
pattern $mAndTermAll :: forall {r} {r}.
Term r
-> ((r ~ Bool) =>
Term Bool -> Term Bool -> HashSet (Term Bool) -> r)
-> ((# #) -> r)
-> r
AndTermAll l r s <- (AndTerm' _ l r s)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE AndTermAll #-}
#endif
pattern EqTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedPrim t) =>
Term t ->
Term t ->
Term r
pattern $mEqTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedPrim t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bEqTerm :: forall r t.
(r ~ Bool, SupportedPrim t) =>
Term t -> Term t -> Term r
EqTerm l r <- (EqTerm' _ l r@SupportedTerm)
where
EqTerm = Term t -> Term t -> Term r
Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE EqTerm #-}
#endif
pattern DistinctTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedPrim t) =>
NonEmpty (Term t) ->
Term r
pattern $mDistinctTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedPrim t) =>
NonEmpty (Term t) -> r)
-> ((# #) -> r)
-> r
$bDistinctTerm :: forall r t.
(r ~ Bool, SupportedPrim t) =>
NonEmpty (Term t) -> Term r
DistinctTerm ts <- (DistinctTerm' _ ts@(SupportedTerm :| _))
where
DistinctTerm = NonEmpty (Term t) -> Term r
NonEmpty (Term t) -> Term Bool
forall t. SupportedPrim t => NonEmpty (Term t) -> Term Bool
pevalDistinctTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE DistinctTerm #-}
#endif
pattern ITETerm ::
forall t.
() =>
(SupportedPrim t) =>
Term Bool ->
Term t ->
Term t ->
Term t
pattern $mITETerm :: forall {r} {t}.
Term t
-> (SupportedPrim t => Term Bool -> Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bITETerm :: forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
ITETerm cond t1 t2 <- (ITETerm' _ cond t1 t2)
where
ITETerm = Term Bool -> Term t -> Term t -> Term t
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ITETerm #-}
#endif
pattern AddNumTerm ::
forall t.
() =>
(SupportedPrim t, PEvalNumTerm t) =>
Term t ->
Term t ->
Term t
pattern $mAddNumTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalNumTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bAddNumTerm :: forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> Term t
AddNumTerm l r <- (AddNumTerm' _ l r)
where
AddNumTerm = Term t -> Term t -> Term t
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE AddNumTerm #-}
#endif
pattern NegNumTerm ::
forall t.
() =>
(SupportedPrim t, PEvalNumTerm t) =>
Term t ->
Term t
pattern $mNegNumTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalNumTerm t) => Term t -> r)
-> ((# #) -> r)
-> r
$bNegNumTerm :: forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> Term t
NegNumTerm t <- (NegNumTerm' _ t)
where
NegNumTerm = Term t -> Term t
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE NegNumTerm #-}
#endif
pattern MulNumTerm ::
forall t.
() =>
(SupportedPrim t, PEvalNumTerm t) =>
Term t ->
Term t ->
Term t
pattern $mMulNumTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalNumTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bMulNumTerm :: forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> Term t
MulNumTerm l r <- (MulNumTerm' _ l r)
where
MulNumTerm = Term t -> Term t -> Term t
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE MulNumTerm #-}
#endif
pattern AbsNumTerm ::
forall t.
() =>
(SupportedPrim t, PEvalNumTerm t) =>
Term t ->
Term t
pattern $mAbsNumTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalNumTerm t) => Term t -> r)
-> ((# #) -> r)
-> r
$bAbsNumTerm :: forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> Term t
AbsNumTerm t <- (AbsNumTerm' _ t)
where
AbsNumTerm = Term t -> Term t
forall t. PEvalNumTerm t => Term t -> Term t
pevalAbsNumTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE AbsNumTerm #-}
#endif
pattern SignumNumTerm ::
forall t.
() =>
(SupportedPrim t, PEvalNumTerm t) =>
Term t ->
Term t
pattern $mSignumNumTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalNumTerm t) => Term t -> r)
-> ((# #) -> r)
-> r
$bSignumNumTerm :: forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> Term t
SignumNumTerm t <- (SignumNumTerm' _ t)
where
SignumNumTerm = Term t -> Term t
forall t. PEvalNumTerm t => Term t -> Term t
pevalSignumNumTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE SignumNumTerm #-}
#endif
pattern LtOrdTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t ->
Term t ->
Term r
pattern $mLtOrdTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bLtOrdTerm :: forall r t.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t -> Term t -> Term r
LtOrdTerm l r <- (LtOrdTerm' _ l r@SupportedTerm)
where
LtOrdTerm = Term t -> Term t -> Term r
Term t -> Term t -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLtOrdTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE LtOrdTerm #-}
#endif
pattern LeOrdTerm ::
forall r.
() =>
forall t.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t ->
Term t ->
Term r
pattern $mLeOrdTerm :: forall {r} {r}.
Term r
-> (forall {t}.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bLeOrdTerm :: forall r t.
(r ~ Bool, SupportedPrim t, PEvalOrdTerm t) =>
Term t -> Term t -> Term r
LeOrdTerm l r <- (LeOrdTerm' _ l r@SupportedTerm)
where
LeOrdTerm = Term t -> Term t -> Term r
Term t -> Term t -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLeOrdTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE LeOrdTerm #-}
#endif
pattern AndBitsTerm ::
forall t.
() =>
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t ->
Term t ->
Term t
pattern $mAndBitsTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalBitwiseTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bAndBitsTerm :: forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
AndBitsTerm l r <- (AndBitsTerm' _ l r)
where
AndBitsTerm = Term t -> Term t -> Term t
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE AndBitsTerm #-}
#endif
pattern OrBitsTerm ::
forall t.
() =>
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t ->
Term t ->
Term t
pattern $mOrBitsTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalBitwiseTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bOrBitsTerm :: forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
OrBitsTerm l r <- (OrBitsTerm' _ l r)
where
OrBitsTerm = Term t -> Term t -> Term t
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE OrBitsTerm #-}
#endif
pattern XorBitsTerm ::
forall t.
() =>
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t ->
Term t ->
Term t
pattern $mXorBitsTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalBitwiseTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bXorBitsTerm :: forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
XorBitsTerm l r <- (XorBitsTerm' _ l r)
where
XorBitsTerm = Term t -> Term t -> Term t
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalXorBitsTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE XorBitsTerm #-}
#endif
pattern ComplementBitsTerm ::
forall t.
() =>
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t ->
Term t
pattern $mComplementBitsTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalBitwiseTerm t) => Term t -> r)
-> ((# #) -> r)
-> r
$bComplementBitsTerm :: forall t. (SupportedPrim t, PEvalBitwiseTerm t) => Term t -> Term t
ComplementBitsTerm t <- (ComplementBitsTerm' _ t)
where
ComplementBitsTerm = Term t -> Term t
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ComplementBitsTerm #-}
#endif
pattern ShiftLeftTerm ::
forall t.
() =>
(SupportedPrim t, PEvalShiftTerm t) =>
Term t ->
Term t ->
Term t
pattern $mShiftLeftTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalShiftTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bShiftLeftTerm :: forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> Term t
ShiftLeftTerm l r <- (ShiftLeftTerm' _ l r)
where
ShiftLeftTerm = Term t -> Term t -> Term t
forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
pevalShiftLeftTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ShiftLeftTerm #-}
#endif
pattern ShiftRightTerm ::
forall t.
() =>
(SupportedPrim t, PEvalShiftTerm t) =>
Term t ->
Term t ->
Term t
pattern $mShiftRightTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalShiftTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bShiftRightTerm :: forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> Term t
ShiftRightTerm l r <- (ShiftRightTerm' _ l r)
where
ShiftRightTerm = Term t -> Term t -> Term t
forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
pevalShiftRightTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ShiftRightTerm #-}
#endif
pattern RotateLeftTerm ::
forall t.
() =>
(SupportedPrim t, PEvalRotateTerm t) =>
Term t ->
Term t ->
Term t
pattern $mRotateLeftTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalRotateTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bRotateLeftTerm :: forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> Term t
RotateLeftTerm l r <- (RotateLeftTerm' _ l r)
where
RotateLeftTerm = Term t -> Term t -> Term t
forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
pevalRotateLeftTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE RotateLeftTerm #-}
#endif
pattern RotateRightTerm ::
forall t.
() =>
(SupportedPrim t, PEvalRotateTerm t) =>
Term t ->
Term t ->
Term t
pattern $mRotateRightTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalRotateTerm t) => Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bRotateRightTerm :: forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> Term t
RotateRightTerm l r <- (RotateRightTerm' _ l r)
where
RotateRightTerm = Term t -> Term t -> Term t
forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
pevalRotateRightTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE RotateRightTerm #-}
#endif
pattern BitCastTerm ::
forall b.
() =>
forall a.
(SupportedPrim a, SupportedPrim b, PEvalBitCastTerm a b) =>
Term a ->
Term b
pattern $mBitCastTerm :: forall {r} {b}.
Term b
-> (forall {a}.
(SupportedPrim a, SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> r)
-> ((# #) -> r)
-> r
$bBitCastTerm :: forall b a.
(SupportedPrim a, SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> Term b
BitCastTerm t <- (BitCastTerm' _ t@SupportedTerm)
where
BitCastTerm = Term a -> Term b
forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BitCastTerm #-}
#endif
pattern BitCastOrTerm ::
forall b.
() =>
forall a.
(SupportedPrim a, SupportedPrim b, PEvalBitCastOrTerm a b) =>
Term b ->
Term a ->
Term b
pattern $mBitCastOrTerm :: forall {r} {b}.
Term b
-> (forall {a}.
(SupportedPrim a, SupportedPrim b, PEvalBitCastOrTerm a b) =>
Term b -> Term a -> r)
-> ((# #) -> r)
-> r
$bBitCastOrTerm :: forall b a.
(SupportedPrim a, SupportedPrim b, PEvalBitCastOrTerm a b) =>
Term b -> Term a -> Term b
BitCastOrTerm t1 t2 <- (BitCastOrTerm' _ t1 t2@SupportedTerm)
where
BitCastOrTerm = Term b -> Term a -> Term b
forall a b. PEvalBitCastOrTerm a b => Term b -> Term a -> Term b
pevalBitCastOrTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BitCastOrTerm #-}
#endif
pattern BVConcatTerm ::
forall ret.
() =>
forall bv l r.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r,
SupportedPrim (bv l),
SupportedPrim (bv r),
SupportedPrim (bv (l + r)),
ret ~ bv (l + r)
) =>
Term (bv l) ->
Term (bv r) ->
Term ret
pattern $mBVConcatTerm :: forall {r} {ret}.
Term ret
-> (forall {bv :: Natural -> *} {l :: Natural} {r :: Natural}.
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv l), SupportedPrim (bv r),
SupportedPrim (bv (l + r)), ret ~ bv (l + r)) =>
Term (bv l) -> Term (bv r) -> r)
-> ((# #) -> r)
-> r
$bBVConcatTerm :: forall ret (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv l), SupportedPrim (bv r),
SupportedPrim (bv (l + r)), ret ~ bv (l + r)) =>
Term (bv l) -> Term (bv r) -> Term ret
BVConcatTerm l r <- (BVConcatTerm' _ l@SupportedTerm r@SupportedTerm)
where
BVConcatTerm = Term (bv l) -> Term (bv r) -> Term ret
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BVConcatTerm #-}
#endif
pattern BVSelectTerm ::
forall ret.
() =>
forall bv w n ix.
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
SupportedPrim (bv n),
SupportedPrim (bv w),
ret ~ bv w
) =>
Proxy ix ->
Proxy w ->
Term (bv n) ->
Term ret
pattern $mBVSelectTerm :: forall {r} {ret}.
Term ret
-> (forall {bv :: Natural -> *} {w :: Natural} {n :: Natural}
{ix :: Natural}.
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv n), SupportedPrim (bv w),
ret ~ bv w) =>
Proxy ix -> Proxy w -> Term (bv n) -> r)
-> ((# #) -> r)
-> r
$bBVSelectTerm :: forall ret (bv :: Natural -> *) (w :: Natural) (n :: Natural)
(ix :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv n), SupportedPrim (bv w),
ret ~ bv w) =>
Proxy ix -> Proxy w -> Term (bv n) -> Term ret
BVSelectTerm ix w t <- (BVSelectTerm' _ ix w t@SupportedTerm)
where
BVSelectTerm = Proxy ix -> Proxy w -> Term (bv n) -> Term ret
Proxy ix -> Proxy w -> Term (bv n) -> Term (bv w)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BVSelectTerm #-}
#endif
pattern BVExtendTerm ::
forall ret.
() =>
forall bv l r.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv l),
SupportedPrim (bv r),
ret ~ bv r
) =>
Bool ->
Proxy r ->
Term (bv l) ->
Term ret
pattern $mBVExtendTerm :: forall {r} {ret}.
Term ret
-> (forall {bv :: Natural -> *} {l :: Natural} {r :: Natural}.
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv l), SupportedPrim (bv r), ret ~ bv r) =>
Bool -> Proxy r -> Term (bv l) -> r)
-> ((# #) -> r)
-> r
$bBVExtendTerm :: forall ret (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv l), SupportedPrim (bv r), ret ~ bv r) =>
Bool -> Proxy r -> Term (bv l) -> Term ret
BVExtendTerm signed p t <- (BVExtendTerm' _ signed p t@SupportedTerm)
where
BVExtendTerm = Bool -> Proxy r -> Term (bv l) -> Term ret
Bool -> Proxy r -> Term (bv l) -> Term (bv r)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BVExtendTerm #-}
#endif
pattern ApplyTerm ::
forall b.
() =>
forall f a.
(PEvalApplyTerm f a b, SupportedPrim f, SupportedPrim a, SupportedPrim b) =>
Term f ->
Term a ->
Term b
pattern $mApplyTerm :: forall {r} {b}.
Term b
-> (forall {f} {a}.
(PEvalApplyTerm f a b, SupportedPrim f, SupportedPrim a,
SupportedPrim b) =>
Term f -> Term a -> r)
-> ((# #) -> r)
-> r
$bApplyTerm :: forall b f a.
(PEvalApplyTerm f a b, SupportedPrim f, SupportedPrim a,
SupportedPrim b) =>
Term f -> Term a -> Term b
ApplyTerm f x <- (ApplyTerm' _ f@SupportedTerm x@SupportedTerm)
where
ApplyTerm = Term f -> Term a -> Term b
forall f a b. PEvalApplyTerm f a b => Term f -> Term a -> Term b
pevalApplyTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ApplyTerm #-}
#endif
pattern DivIntegralTerm ::
forall t.
() =>
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t ->
Term t ->
Term t
pattern $mDivIntegralTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bDivIntegralTerm :: forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> Term t
DivIntegralTerm l r <- (DivIntegralTerm' _ l r)
where
DivIntegralTerm = Term t -> Term t -> Term t
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
pevalDivIntegralTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE DivIntegralTerm #-}
#endif
pattern ModIntegralTerm ::
forall t.
() =>
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t ->
Term t ->
Term t
pattern $mModIntegralTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bModIntegralTerm :: forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> Term t
ModIntegralTerm l r <- (ModIntegralTerm' _ l r)
where
ModIntegralTerm = Term t -> Term t -> Term t
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
pevalModIntegralTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ModIntegralTerm #-}
#endif
pattern QuotIntegralTerm ::
forall t.
() =>
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t ->
Term t ->
Term t
pattern $mQuotIntegralTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bQuotIntegralTerm :: forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> Term t
QuotIntegralTerm l r <- (QuotIntegralTerm' _ l r)
where
QuotIntegralTerm = Term t -> Term t -> Term t
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
pevalQuotIntegralTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE QuotIntegralTerm #-}
#endif
pattern RemIntegralTerm ::
forall t.
() =>
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t ->
Term t ->
Term t
pattern $mRemIntegralTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bRemIntegralTerm :: forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> Term t
RemIntegralTerm l r <- (RemIntegralTerm' _ l r)
where
RemIntegralTerm = Term t -> Term t -> Term t
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
pevalRemIntegralTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE RemIntegralTerm #-}
#endif
pattern FPTraitTerm ::
forall r.
() =>
forall eb sb fp.
(r ~ Bool, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait ->
Term (fp eb sb) ->
Term r
pattern $mFPTraitTerm :: forall {r} {r}.
Term r
-> (forall {eb :: Natural} {sb :: Natural}
{fp :: Natural -> Natural -> *}.
(r ~ Bool, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPTraitTerm :: forall r (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(r ~ Bool, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> Term r
FPTraitTerm trait t <- (FPTraitTerm' _ trait t)
where
FPTraitTerm = FPTrait -> Term (fp eb sb) -> Term r
FPTrait -> Term (fp eb sb) -> Term Bool
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
FPTrait -> Term (fp eb sb) -> Term Bool
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
FPTrait -> Term (fp eb sb) -> Term Bool
pevalFPTraitTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPTraitTerm #-}
#endif
pattern FdivTerm ::
forall t.
() =>
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t ->
Term t ->
Term t
pattern $mFdivTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bFdivTerm :: forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> Term t -> Term t
FdivTerm l r <- (FdivTerm' _ l r)
where
FdivTerm = Term t -> Term t -> Term t
forall t. PEvalFractionalTerm t => Term t -> Term t -> Term t
pevalFdivTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FdivTerm #-}
#endif
pattern RecipTerm ::
forall t.
() =>
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t ->
Term t
pattern $mRecipTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalFractionalTerm t) => Term t -> r)
-> ((# #) -> r)
-> r
$bRecipTerm :: forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> Term t
RecipTerm t <- (RecipTerm' _ t)
where
RecipTerm = Term t -> Term t
forall t. PEvalFractionalTerm t => Term t -> Term t
pevalRecipTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE RecipTerm #-}
#endif
pattern FloatingUnaryTerm ::
forall t.
() =>
(SupportedPrim t, PEvalFloatingTerm t) =>
FloatingUnaryOp ->
Term t ->
Term t
pattern $mFloatingUnaryTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalFloatingTerm t) =>
FloatingUnaryOp -> Term t -> r)
-> ((# #) -> r)
-> r
$bFloatingUnaryTerm :: forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
FloatingUnaryOp -> Term t -> Term t
FloatingUnaryTerm op t <- (FloatingUnaryTerm' _ op t)
where
FloatingUnaryTerm = FloatingUnaryOp -> Term t -> Term t
forall t.
PEvalFloatingTerm t =>
FloatingUnaryOp -> Term t -> Term t
pevalFloatingUnaryTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FloatingUnaryTerm #-}
#endif
pattern PowerTerm ::
forall t.
() =>
(SupportedPrim t, PEvalFloatingTerm t) =>
Term t ->
Term t ->
Term t
pattern $mPowerTerm :: forall {r} {t}.
Term t
-> ((SupportedPrim t, PEvalFloatingTerm t) =>
Term t -> Term t -> r)
-> ((# #) -> r)
-> r
$bPowerTerm :: forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
Term t -> Term t -> Term t
PowerTerm l r <- (PowerTerm' _ l r)
where
PowerTerm = Term t -> Term t -> Term t
forall t. PEvalFloatingTerm t => Term t -> Term t -> Term t
pevalPowerTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE PowerTerm #-}
#endif
pattern FPUnaryTerm ::
forall ret.
() =>
forall fp eb sb.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp ->
Term (fp eb sb) ->
Term ret
pattern $mFPUnaryTerm :: forall {r} {ret}.
Term ret
-> (forall {fp :: Natural -> Natural -> *} {eb :: Natural}
{sb :: Natural}.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPUnaryTerm :: forall ret (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> Term ret
FPUnaryTerm op t <- (FPUnaryTerm' _ op t)
where
FPUnaryTerm = FPUnaryOp -> Term (fp eb sb) -> Term ret
FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
pevalFPUnaryTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPUnaryTerm #-}
#endif
pattern FPBinaryTerm ::
forall ret.
() =>
forall fp eb sb.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term ret
pattern $mFPBinaryTerm :: forall {r} {ret}.
Term ret
-> (forall {fp :: Natural -> Natural -> *} {eb :: Natural}
{sb :: Natural}.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPBinaryTerm :: forall ret (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term ret
FPBinaryTerm op l r <- (FPBinaryTerm' _ op l r)
where
FPBinaryTerm = FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term ret
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
pevalFPBinaryTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPBinaryTerm #-}
#endif
pattern FPRoundingUnaryTerm ::
forall ret.
() =>
forall fp eb sb.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term ret
pattern $mFPRoundingUnaryTerm :: forall {r} {ret}.
Term ret
-> (forall {fp :: Natural -> Natural -> *} {eb :: Natural}
{sb :: Natural}.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPRoundingUnaryOp -> Term FPRoundingMode -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPRoundingUnaryTerm :: forall ret (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term ret
FPRoundingUnaryTerm op rm t <- (FPRoundingUnaryTerm' _ op rm t)
where
FPRoundingUnaryTerm = FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term ret
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
pevalFPRoundingUnaryTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPRoundingUnaryTerm #-}
#endif
pattern FPRoundingBinaryTerm ::
forall ret.
() =>
forall fp eb sb.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term ret
pattern $mFPRoundingBinaryTerm :: forall {r} {ret}.
Term ret
-> (forall {fp :: Natural -> Natural -> *} {eb :: Natural}
{sb :: Natural}.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPRoundingBinaryTerm :: forall ret (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term ret
FPRoundingBinaryTerm op rm l r <- (FPRoundingBinaryTerm' _ op rm l r)
where
FPRoundingBinaryTerm = FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term ret
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
pevalFPRoundingBinaryTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPRoundingBinaryTerm #-}
#endif
pattern FPFMATerm ::
forall ret.
() =>
forall fp eb sb.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term ret
pattern $mFPFMATerm :: forall {r} {ret}.
Term ret
-> (forall {fp :: Natural -> Natural -> *} {eb :: Natural}
{sb :: Natural}.
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
Term FPRoundingMode
-> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb) -> r)
-> ((# #) -> r)
-> r
$bFPFMATerm :: forall ret (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(ret ~ fp eb sb, ValidFP eb sb, SupportedPrim (fp eb sb),
PEvalFPTerm fp) =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term ret
FPFMATerm rm t1 t2 t3 <- (FPFMATerm' _ rm t1 t2 t3)
where
FPFMATerm = Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term ret
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (fp :: Natural -> Natural -> *) (eb :: Natural)
(sb :: Natural).
(PEvalFPTerm fp, ValidFP eb sb) =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
pevalFPFMATerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FPFMATerm #-}
#endif
pattern FromIntegralTerm ::
forall b.
() =>
forall a.
(PEvalFromIntegralTerm a b, SupportedPrim a, SupportedPrim b) =>
Term a ->
Term b
pattern $mFromIntegralTerm :: forall {r} {b}.
Term b
-> (forall {a}.
(PEvalFromIntegralTerm a b, SupportedPrim a, SupportedPrim b) =>
Term a -> r)
-> ((# #) -> r)
-> r
$bFromIntegralTerm :: forall b a.
(PEvalFromIntegralTerm a b, SupportedPrim a, SupportedPrim b) =>
Term a -> Term b
FromIntegralTerm t <- (FromIntegralTerm' _ t@SupportedTerm)
where
FromIntegralTerm = Term a -> Term b
forall a b. PEvalFromIntegralTerm a b => Term a -> Term b
pevalFromIntegralTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FromIntegralTerm #-}
#endif
pattern FromFPOrTerm ::
forall a.
() =>
forall eb sb.
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim a
) =>
Term a ->
Term FPRoundingMode ->
Term (FP eb sb) ->
Term a
pattern $mFromFPOrTerm :: forall {r} {a}.
Term a
-> (forall {eb :: Natural} {sb :: Natural}.
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb, SupportedPrim a) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> r)
-> ((# #) -> r)
-> r
$bFromFPOrTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb, SupportedPrim a) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
FromFPOrTerm t1 rm t2 <- (FromFPOrTerm' _ t1 rm t2)
where
FromFPOrTerm = Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
pevalFromFPOrTerm
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FromFPOrTerm #-}
#endif
pattern ToFPTerm ::
forall ret.
() =>
forall eb sb a.
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim (FP eb sb),
SupportedPrim a,
ret ~ FP eb sb
) =>
Term FPRoundingMode ->
Term a ->
Proxy eb ->
Proxy sb ->
Term ret
pattern $mToFPTerm :: forall {r} {ret}.
Term ret
-> (forall {eb :: Natural} {sb :: Natural} {a}.
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb), SupportedPrim a, ret ~ FP eb sb) =>
Term FPRoundingMode -> Term a -> Proxy eb -> Proxy sb -> r)
-> ((# #) -> r)
-> r
$bToFPTerm :: forall ret (eb :: Natural) (sb :: Natural) a.
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb), SupportedPrim a, ret ~ FP eb sb) =>
Term FPRoundingMode -> Term a -> Proxy eb -> Proxy sb -> Term ret
ToFPTerm rm t eb sb <- (ToFPTerm' _ rm t@SupportedTerm eb sb)
where
ToFPTerm Term FPRoundingMode
rm Term a
t Proxy eb
_ Proxy sb
_ = Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
pevalToFPTerm Term FPRoundingMode
rm Term a
t
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE ToFPTerm #-}
#endif
#if MIN_VERSION_base(4, 16, 4)
{-# COMPLETE
ConTerm,
SymTerm,
ForallTerm,
ExistsTerm,
NotTerm,
OrTerm,
AndTerm,
EqTerm,
DistinctTerm,
ITETerm,
AddNumTerm,
NegNumTerm,
MulNumTerm,
AbsNumTerm,
SignumNumTerm,
LtOrdTerm,
LeOrdTerm,
AndBitsTerm,
OrBitsTerm,
XorBitsTerm,
ComplementBitsTerm,
ShiftLeftTerm,
ShiftRightTerm,
RotateLeftTerm,
RotateRightTerm,
BitCastTerm,
BitCastOrTerm,
BVConcatTerm,
BVSelectTerm,
BVExtendTerm,
ApplyTerm,
DivIntegralTerm,
ModIntegralTerm,
QuotIntegralTerm,
RemIntegralTerm,
FPTraitTerm,
FdivTerm,
RecipTerm,
FloatingUnaryTerm,
PowerTerm,
FPUnaryTerm,
FPBinaryTerm,
FPRoundingUnaryTerm,
FPRoundingBinaryTerm,
FPFMATerm,
FromIntegralTerm,
FromFPOrTerm,
ToFPTerm
#-}
#endif
termInfo :: Term t -> CachedInfo
termInfo :: forall t. Term t -> CachedInfo
termInfo (ConTerm' CachedInfo
i t
_) = CachedInfo
i
termInfo (SymTerm' CachedInfo
i TypedSymbol 'AnyKind t
_) = CachedInfo
i
termInfo (ForallTerm' CachedInfo
i TypedSymbol 'ConstantKind t
_ Term Bool
_) = CachedInfo
i
termInfo (ExistsTerm' CachedInfo
i TypedSymbol 'ConstantKind t
_ Term Bool
_) = CachedInfo
i
termInfo (NotTerm' CachedInfo
i Term Bool
_) = CachedInfo
i
termInfo (OrTerm' CachedInfo
i Term Bool
_ Term Bool
_ HashSet (Term Bool)
_) = CachedInfo
i
termInfo (AndTerm' CachedInfo
i Term Bool
_ Term Bool
_ HashSet (Term Bool)
_) = CachedInfo
i
termInfo (EqTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (DistinctTerm' CachedInfo
i NonEmpty (Term t)
_) = CachedInfo
i
termInfo (ITETerm' CachedInfo
i Term Bool
_ Term t
_ Term t
_) = CachedInfo
i
termInfo (AddNumTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (NegNumTerm' CachedInfo
i Term t
_) = CachedInfo
i
termInfo (MulNumTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (AbsNumTerm' CachedInfo
i Term t
_) = CachedInfo
i
termInfo (SignumNumTerm' CachedInfo
i Term t
_) = CachedInfo
i
termInfo (LtOrdTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (LeOrdTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (AndBitsTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (OrBitsTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (XorBitsTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (ComplementBitsTerm' CachedInfo
i Term t
_) = CachedInfo
i
termInfo (ShiftLeftTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (ShiftRightTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (RotateLeftTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (RotateRightTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (BitCastTerm' CachedInfo
i Term a
_) = CachedInfo
i
termInfo (BitCastOrTerm' CachedInfo
i Term t
_ Term a
_) = CachedInfo
i
termInfo (BVConcatTerm' CachedInfo
i Term (bv l)
_ Term (bv r)
_) = CachedInfo
i
termInfo (BVSelectTerm' CachedInfo
i Proxy ix
_ Proxy w
_ Term (bv n)
_) = CachedInfo
i
termInfo (BVExtendTerm' CachedInfo
i Bool
_ Proxy r
_ Term (bv l)
_) = CachedInfo
i
termInfo (ApplyTerm' CachedInfo
i Term f
_ Term a
_) = CachedInfo
i
termInfo (DivIntegralTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (ModIntegralTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (QuotIntegralTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (RemIntegralTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (FPTraitTerm' CachedInfo
i FPTrait
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FdivTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (RecipTerm' CachedInfo
i Term t
_) = CachedInfo
i
termInfo (FloatingUnaryTerm' CachedInfo
i FloatingUnaryOp
_ Term t
_) = CachedInfo
i
termInfo (PowerTerm' CachedInfo
i Term t
_ Term t
_) = CachedInfo
i
termInfo (FPUnaryTerm' CachedInfo
i FPUnaryOp
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FPBinaryTerm' CachedInfo
i FPBinaryOp
_ Term (fp eb sb)
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FPRoundingUnaryTerm' CachedInfo
i FPRoundingUnaryOp
_ Term FPRoundingMode
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FPRoundingBinaryTerm' CachedInfo
i FPRoundingBinaryOp
_ Term FPRoundingMode
_ Term (fp eb sb)
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FPFMATerm' CachedInfo
i Term FPRoundingMode
_ Term (fp eb sb)
_ Term (fp eb sb)
_ Term (fp eb sb)
_) = CachedInfo
i
termInfo (FromIntegralTerm' CachedInfo
i Term a
_) = CachedInfo
i
termInfo (FromFPOrTerm' CachedInfo
i Term t
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = CachedInfo
i
termInfo (ToFPTerm' CachedInfo
i Term FPRoundingMode
_ Term a
_ Proxy eb
_ Proxy sb
_) = CachedInfo
i
{-# INLINE termThreadId #-}
termThreadId :: Term t -> WeakThreadId
termThreadId :: forall t. Term t -> WeakThreadId
termThreadId = CachedInfo -> WeakThreadId
cachedThreadId (CachedInfo -> WeakThreadId)
-> (Term t -> CachedInfo) -> Term t -> WeakThreadId
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term t -> CachedInfo
forall t. Term t -> CachedInfo
termInfo
{-# INLINE termDigest #-}
termDigest :: Term t -> Digest
termDigest :: forall t. Term t -> Digest
termDigest = CachedInfo -> Digest
cachedDigest (CachedInfo -> Digest)
-> (Term t -> CachedInfo) -> Term t -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term t -> CachedInfo
forall t. Term t -> CachedInfo
termInfo
{-# INLINE termId #-}
termId :: Term t -> Id
termId :: forall t. Term t -> Digest
termId = CachedInfo -> Digest
cachedId (CachedInfo -> Digest)
-> (Term t -> CachedInfo) -> Term t -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term t -> CachedInfo
forall t. Term t -> CachedInfo
termInfo
{-# INLINE termStableIdent #-}
termStableIdent :: Term t -> StableIdent
termStableIdent :: forall t. Term t -> StableName Any
termStableIdent = CachedInfo -> StableName Any
cachedStableIdent (CachedInfo -> StableName Any)
-> (Term t -> CachedInfo) -> Term t -> StableName Any
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term t -> CachedInfo
forall t. Term t -> CachedInfo
termInfo
pattern DynTerm :: forall a b. (SupportedPrim a) => Term a -> Term b
pattern $mDynTerm :: forall {r} {a} {b}.
SupportedPrim a =>
Term b -> (Term a -> r) -> ((# #) -> r) -> r
DynTerm x <- ((\v :: Term b
v@Term b
SupportedTerm -> Term b -> Maybe (Term a)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast Term b
v) -> Just x)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE DynTerm #-}
#endif
data HashId = HashId {-# UNPACK #-} !Digest Id deriving (Int -> HashId -> String -> String
[HashId] -> String -> String
HashId -> String
(Int -> HashId -> String -> String)
-> (HashId -> String)
-> ([HashId] -> String -> String)
-> Show HashId
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HashId -> String -> String
showsPrec :: Int -> HashId -> String -> String
$cshow :: HashId -> String
show :: HashId -> String
$cshowList :: [HashId] -> String -> String
showList :: [HashId] -> String -> String
Show)
instance Eq HashId where
HashId Digest
_ Digest
l == :: HashId -> HashId -> Bool
== HashId Digest
_ Digest
r = Digest
l Digest -> Digest -> Bool
forall a. Eq a => a -> a -> Bool
== Digest
r
{-# INLINE (==) #-}
instance Hashable HashId where
hashWithSalt :: Int -> HashId -> Int
hashWithSalt Int
s (HashId Digest
i Digest
_) = Int -> Digest -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s Digest
i
{-# INLINE hashWithSalt #-}
eqHashId :: HashId -> HashId -> Bool
eqHashId :: HashId -> HashId -> Bool
eqHashId = HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
(==)
{-# INLINE eqHashId #-}
data TypeHashId = TypeHashId {-# UNPACK #-} !Fingerprint {-# UNPACK #-} !HashId
deriving (Int -> TypeHashId -> String -> String
[TypeHashId] -> String -> String
TypeHashId -> String
(Int -> TypeHashId -> String -> String)
-> (TypeHashId -> String)
-> ([TypeHashId] -> String -> String)
-> Show TypeHashId
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> TypeHashId -> String -> String
showsPrec :: Int -> TypeHashId -> String -> String
$cshow :: TypeHashId -> String
show :: TypeHashId -> String
$cshowList :: [TypeHashId] -> String -> String
showList :: [TypeHashId] -> String -> String
Show)
instance Eq TypeHashId where
TypeHashId Fingerprint
l HashId
li == :: TypeHashId -> TypeHashId -> Bool
== TypeHashId Fingerprint
r HashId
ri = Fingerprint
l Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
r Bool -> Bool -> Bool
&& HashId
li HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
== HashId
ri
{-# INLINE (==) #-}
instance Hashable TypeHashId where
hashWithSalt :: Int -> TypeHashId -> Int
hashWithSalt Int
s (TypeHashId Fingerprint
tp HashId
i) = Int
s Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
i
{-# INLINE hashWithSalt #-}
{-# INLINE termHashId #-}
termHashId :: Term t -> HashId
termHashId :: forall t. Term t -> HashId
termHashId Term t
t = Digest -> Digest -> HashId
HashId (Term t -> Digest
forall t. Term t -> Digest
termDigest Term t
t) (Term t -> Digest
forall t. Term t -> Digest
termId Term t
t)
typeFingerprint :: forall t. (SupportedPrim t) => Fingerprint
typeFingerprint :: forall t. SupportedPrim t => Fingerprint
typeFingerprint = SomeTypeRep -> Fingerprint
typeRepFingerprint (SomeTypeRep -> Fingerprint) -> SomeTypeRep -> Fingerprint
forall a b. (a -> b) -> a -> b
$ TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep t -> SomeTypeRep) -> TypeRep t -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @t
{-# INLINE typeFingerprint #-}
{-# INLINE termTypeHashId #-}
termTypeHashId :: forall t. Term t -> TypeHashId
termTypeHashId :: forall t. Term t -> TypeHashId
termTypeHashId t :: Term t
t@Term t
SupportedTerm = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
t)
introSupportedPrimConstraint0 :: forall t a. Term t -> ((SupportedPrim t) => a) -> a
introSupportedPrimConstraint0 :: forall t a. Term t -> (SupportedPrim t => a) -> a
introSupportedPrimConstraint0 ConTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 (SymTerm' CachedInfo
_ TypedSymbol 'AnyKind t
t) SupportedPrim t => a
x = TypedSymbol 'AnyKind t -> (SupportedPrim t => a) -> a
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (SupportedPrim t => a) -> a
withSymbolSupported TypedSymbol 'AnyKind t
t a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ForallTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ExistsTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 NotTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 OrTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AndTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 EqTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 DistinctTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ITETerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AddNumTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 NegNumTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 MulNumTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AbsNumTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 SignumNumTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 LtOrdTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 LeOrdTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AndBitsTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 OrBitsTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 XorBitsTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ComplementBitsTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ShiftLeftTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RotateLeftTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ShiftRightTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RotateRightTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BitCastTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BitCastOrTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVConcatTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVSelectTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVExtendTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ApplyTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 DivIntegralTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ModIntegralTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 QuotIntegralTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RemIntegralTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPTraitTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FdivTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RecipTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FloatingUnaryTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 PowerTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPUnaryTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPBinaryTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPRoundingUnaryTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPRoundingBinaryTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPFMATerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FromIntegralTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FromFPOrTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ToFPTerm' {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint ::
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint :: forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
t (SupportedPrim t, Typeable t) => a
a = Term t -> (SupportedPrim t => a) -> a
forall t a. Term t -> (SupportedPrim t => a) -> a
introSupportedPrimConstraint0 Term t
t a
SupportedPrim t => a
(SupportedPrim t, Typeable t) => a
a
{-# INLINE introSupportedPrimConstraint #-}
pformatTerm :: forall t. Term t -> String
pformatTerm :: forall t. Term t -> String
pformatTerm (ConTerm t
t) = t -> String
forall t. SupportedPrim t => t -> String
pformatCon t
t
pformatTerm (SymTerm TypedSymbol 'AnyKind t
sym) = TypedSymbol 'AnyKind t -> String
forall (knd :: SymbolKind) t. TypedSymbol knd t -> String
showUntyped TypedSymbol 'AnyKind t
sym
pformatTerm (ForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = String
"(forall " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = String
"(exists " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (NotTerm Term Bool
arg) = String
"(! " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (OrTerm Term Bool
arg1 Term Bool
arg2) = String
"(|| " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AndTerm Term Bool
arg1 Term Bool
arg2) = String
"(&& " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (EqTerm Term t
arg1 Term t
arg2) = String
"(= " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (DistinctTerm NonEmpty (Term t)
args) = String
"(distinct " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords ((Term t -> String) -> [Term t] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Term t -> String
forall t. Term t -> String
pformatTerm ([Term t] -> [String]) -> [Term t] -> [String]
forall a b. (a -> b) -> a -> b
$ NonEmpty (Term t) -> [Term t]
forall a. NonEmpty a -> [a]
toList NonEmpty (Term t)
args) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ITETerm Term Bool
cond Term t
arg1 Term t
arg2) = String
"(ite " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
cond String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AddNumTerm Term t
arg1 Term t
arg2) = String
"(+ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (NegNumTerm Term t
arg) = String
"(- " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (MulNumTerm Term t
arg1 Term t
arg2) = String
"(* " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AbsNumTerm Term t
arg) = String
"(abs " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (SignumNumTerm Term t
arg) = String
"(signum " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (LtOrdTerm Term t
arg1 Term t
arg2) = String
"(< " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (LeOrdTerm Term t
arg1 Term t
arg2) = String
"(<= " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AndBitsTerm Term t
arg1 Term t
arg2) = String
"(& " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (OrBitsTerm Term t
arg1 Term t
arg2) = String
"(| " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (XorBitsTerm Term t
arg1 Term t
arg2) = String
"(^ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ComplementBitsTerm Term t
arg) = String
"(~ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ShiftLeftTerm Term t
arg Term t
n) = String
"(shl " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ShiftRightTerm Term t
arg Term t
n) = String
"(shr " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RotateLeftTerm Term t
arg Term t
n) = String
"(rotl " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RotateRightTerm Term t
arg Term t
n) = String
"(rotr " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BitCastTerm Term a
arg) = String
"(bitcast " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BitCastOrTerm Term t
d Term a
arg) = String
"(bitcast_or " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
d String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2) = String
"(bvconcat " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall t. Term t -> String
pformatTerm Term (bv l)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv r) -> String
forall t. Term t -> String
pformatTerm Term (bv r)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVSelectTerm (Proxy ix
_ :: Proxy ix) (Proxy w
_ :: Proxy w) Term (bv n)
arg) =
String
"(bvselect " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep ix -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @ix) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep w -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @w) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv n) -> String
forall t. Term t -> String
pformatTerm Term (bv n)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVExtendTerm Bool
signed (Proxy r
_ :: Proxy n) Term (bv l)
arg) =
(if Bool
signed then String
"(bvsext " else String
"(bvzext ") String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep r -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @n) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall t. Term t -> String
pformatTerm Term (bv l)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ApplyTerm Term f
func Term a
arg) = String
"(apply " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term f -> String
forall t. Term t -> String
pformatTerm Term f
func String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (DivIntegralTerm Term t
arg1 Term t
arg2) = String
"(div " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ModIntegralTerm Term t
arg1 Term t
arg2) = String
"(mod " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (QuotIntegralTerm Term t
arg1 Term t
arg2) = String
"(quot " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RemIntegralTerm Term t
arg1 Term t
arg2) = String
"(rem " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPTraitTerm FPTrait
trait Term (fp eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPTrait -> String
forall a. Show a => a -> String
show FPTrait
trait String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FdivTerm Term t
arg1 Term t
arg2) = String
"(fdiv " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RecipTerm Term t
arg) = String
"(recip " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FloatingUnaryTerm FloatingUnaryOp
op Term t
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FloatingUnaryOp -> String
forall a. Show a => a -> String
show FloatingUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (PowerTerm Term t
arg1 Term t
arg2) = String
"(** " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPUnaryTerm FPUnaryOp
op Term (fp eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPUnaryOp -> String
forall a. Show a => a -> String
show FPUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPBinaryTerm FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPBinaryOp -> String
forall a. Show a => a -> String
show FPBinaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingUnaryOp -> String
forall a. Show a => a -> String
show FPRoundingUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingBinaryOp -> String
forall a. Show a => a -> String
show FPRoundingBinaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3) =
String
"(fp.fma " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall t. Term t -> String
pformatTerm Term (fp eb sb)
arg3 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FromIntegralTerm Term a
arg) = String
"(from_integral " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FromFPOrTerm Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg) = String
"(from_fp_or " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
d String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
r String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ToFPTerm Term FPRoundingMode
r Term a
arg Proxy eb
_ Proxy sb
_) = String
"(to_fp " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
r String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
instance NFData (Term a) where
rnf :: Term a -> ()
rnf Term a
i = CachedInfo -> ()
forall a. NFData a => a -> ()
rnf (Term a -> CachedInfo
forall t. Term t -> CachedInfo
termInfo Term a
i)
{-# INLINE rnf #-}
#if MIN_VERSION_base(4,15,0)
type CODE x = forall qq. Quote qq => Code qq (x)
#else
type CODE x = TExpQ x
#endif
instance Lift (Term t) where
liftTyped :: forall (m :: * -> *). Quote m => Term t -> Code m (Term t)
liftTyped (ConTerm t
v) = [||t -> Term t
forall t. SupportedPrim t => t -> Term t
conTerm t
v||]
liftTyped (SymTerm TypedSymbol 'AnyKind t
t) = [||TypedSymbol knd t -> Term t
forall (knd :: SymbolKind) t. TypedSymbol knd t -> Term t
symTerm TypedSymbol 'AnyKind t
t||]
liftTyped (ForallTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2) = [||TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forallTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2||]
liftTyped (ExistsTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2) = [||TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
existsTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2||]
liftTyped (NotTerm Term Bool
t) = [||Term Bool -> Term Bool
notTerm Term Bool
t||]
liftTyped (OrTerm Term Bool
t1 Term Bool
t2) = [||Term Bool -> Term Bool -> Term Bool
orTerm Term Bool
t1 Term Bool
t2||]
liftTyped (AndTerm Term Bool
t1 Term Bool
t2) = [||Term Bool -> Term Bool -> Term Bool
andTerm Term Bool
t1 Term Bool
t2||]
liftTyped (EqTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term t
t1 Term t
t2||]
liftTyped (DistinctTerm NonEmpty (Term t)
t) = [||NonEmpty (Term a) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term t)
t||]
liftTyped (ITETerm Term Bool
t1 Term t
t2 Term t
t3) = [||Term Bool -> Term a -> Term a -> Term a
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
t1 Term t
t2 Term t
t3||]
liftTyped (AddNumTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm Term t
t1 Term t
t2||]
liftTyped (NegNumTerm Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
negNumTerm Term t
t||]
liftTyped (MulNumTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm Term t
t1 Term t
t2||]
liftTyped (AbsNumTerm Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
absNumTerm Term t
t||]
liftTyped (SignumNumTerm Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
signumNumTerm Term t
t||]
liftTyped (LtOrdTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
ltOrdTerm Term t
t1 Term t
t2||]
liftTyped (LeOrdTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
leOrdTerm Term t
t1 Term t
t2||]
liftTyped (AndBitsTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term t
t1 Term t
t2||]
liftTyped (OrBitsTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term t
t1 Term t
t2||]
liftTyped (XorBitsTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
xorBitsTerm Term t
t1 Term t
t2||]
liftTyped (ComplementBitsTerm Term t
t) = [||Term a -> Term a
forall t. PEvalBitwiseTerm t => Term t -> Term t
complementBitsTerm Term t
t||]
liftTyped (ShiftLeftTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
shiftLeftTerm Term t
t1 Term t
t2||]
liftTyped (ShiftRightTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
shiftRightTerm Term t
t1 Term t
t2||]
liftTyped (RotateLeftTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
rotateLeftTerm Term t
t1 Term t
t2||]
liftTyped (RotateRightTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
rotateRightTerm Term t
t1 Term t
t2||]
liftTyped (BitCastTerm Term a
t) = [||Term a -> Term b
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm Term a
t||]
liftTyped (BitCastOrTerm Term t
t1 Term a
t2) = [||Term b -> Term a -> Term b
forall a b. PEvalBitCastOrTerm a b => Term b -> Term a -> Term b
bitCastOrTerm Term b
t1 Term a
t2||]
liftTyped (BVConcatTerm Term (bv l)
t1 Term (bv r)
t2) = [||Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm Term (bv l)
t1 Term (bv r)
t2||]
liftTyped (BVSelectTerm (Proxy ix
_ :: p ix) (Proxy w
_ :: q w) Term (bv n)
t3) =
let pix :: Code m (Proxy ix)
pix = [||Proxy t
forall {k} (t :: k). Proxy t
Proxy||] :: CODE (Proxy ix)
pw :: Code m (Proxy w)
pw = [||Proxy t
forall {k} (t :: k). Proxy t
Proxy||] :: CODE (Proxy w)
in [||p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
bvSelectTerm $$Code m (Proxy ix)
pix $$Code m (Proxy w)
pw Term (bv n)
t3||]
liftTyped (BVExtendTerm Bool
b (Proxy r
_ :: p r) Term (bv l)
t2) =
let pr :: Code m (Proxy r)
pr = [||Proxy t
forall {k} (t :: k). Proxy t
Proxy||] :: CODE (Proxy r)
in [||Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
b $$Code m (Proxy r)
pr Term (bv l)
t2||]
liftTyped (ApplyTerm Term f
t1 Term a
t2) = [||Term f -> Term a -> Term b
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> Term b
applyTerm Term f
t1 Term a
t2||]
liftTyped (DivIntegralTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
divIntegralTerm Term t
t1 Term t
t2||]
liftTyped (ModIntegralTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
modIntegralTerm Term t
t1 Term t
t2||]
liftTyped (QuotIntegralTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
quotIntegralTerm Term t
t1 Term t
t2||]
liftTyped (RemIntegralTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
remIntegralTerm Term t
t1 Term t
t2||]
liftTyped (FPTraitTerm FPTrait
t1 Term (fp eb sb)
t2) = [||FPTrait -> Term (fp eb sb) -> Term Bool
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> Term Bool
fpTraitTerm FPTrait
t1 Term (fp eb sb)
t2||]
liftTyped (FdivTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalFractionalTerm t => Term t -> Term t -> Term t
fdivTerm Term t
t1 Term t
t2||]
liftTyped (RecipTerm Term t
t) = [||Term a -> Term a
forall t. PEvalFractionalTerm t => Term t -> Term t
recipTerm Term t
t||]
liftTyped (FloatingUnaryTerm FloatingUnaryOp
t1 Term t
t2) = [||FloatingUnaryOp -> Term a -> Term a
forall t.
PEvalFloatingTerm t =>
FloatingUnaryOp -> Term t -> Term t
floatingUnaryTerm FloatingUnaryOp
t1 Term t
t2||]
liftTyped (PowerTerm Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall t. PEvalFloatingTerm t => Term t -> Term t -> Term t
powerTerm Term t
t1 Term t
t2||]
liftTyped (FPUnaryTerm FPUnaryOp
t1 Term (fp eb sb)
t2) = [||FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
fpUnaryTerm FPUnaryOp
t1 Term (fp eb sb)
t2||]
liftTyped (FPBinaryTerm FPBinaryOp
t1 Term (fp eb sb)
t2 Term (fp eb sb)
t3) = [||FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
fpBinaryTerm FPBinaryOp
t1 Term (fp eb sb)
t2 Term (fp eb sb)
t3||]
liftTyped (FPRoundingUnaryTerm FPRoundingUnaryOp
t1 Term FPRoundingMode
t2 Term (fp eb sb)
t3) =
[||FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
fpRoundingUnaryTerm FPRoundingUnaryOp
t1 Term FPRoundingMode
t2 Term (fp eb sb)
t3||]
liftTyped (FPRoundingBinaryTerm FPRoundingBinaryOp
t1 Term FPRoundingMode
t2 Term (fp eb sb)
t3 Term (fp eb sb)
t4) =
[||FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
fpRoundingBinaryTerm FPRoundingBinaryOp
t1 Term FPRoundingMode
t2 Term (fp eb sb)
t3 Term (fp eb sb)
t4||]
liftTyped (FPFMATerm Term FPRoundingMode
t1 Term (fp eb sb)
t2 Term (fp eb sb)
t3 Term (fp eb sb)
t4) = [||Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
fpFMATerm Term FPRoundingMode
t1 Term (fp eb sb)
t2 Term (fp eb sb)
t3 Term (fp eb sb)
t4||]
liftTyped (FromIntegralTerm Term a
t) = [||Term a -> Term b
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> Term b
fromIntegralTerm Term a
t||]
liftTyped (FromFPOrTerm Term t
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3) = [||Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
fromFPOrTerm Term a
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3||]
liftTyped (ToFPTerm Term FPRoundingMode
t1 Term a
t2 Proxy eb
_ Proxy sb
_) =
[||Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
toFPTerm Term FPRoundingMode
t1 Term a
t2||]
instance Show (Term ty) where
show :: Term ty -> String
show t :: Term ty
t@(ConTerm ty
v) =
String
"ConTerm{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", v="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ ty -> String
forall t. SupportedPrim t => t -> String
pformatCon ty
v
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(SymTerm name :: TypedSymbol 'AnyKind ty
name@TypedSymbol {}) =
String
"SymTerm{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", name="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'AnyKind ty -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind ty
name
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", type="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep ty -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @ty)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
String
"Forall{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", sym="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
String
"Exists{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", sym="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(NotTerm Term Bool
arg) =
String
"Not{tid=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(OrTerm Term Bool
arg1 Term Bool
arg2) =
String
"Or{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(AndTerm Term Bool
arg1 Term Bool
arg2) =
String
"And{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(EqTerm Term t
arg1 Term t
arg2) =
String
"Eqv{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(DistinctTerm NonEmpty (Term t)
args) =
String
"Distinct{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", args="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ NonEmpty (Term t) -> String
forall a. Show a => a -> String
show NonEmpty (Term t)
args
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ITETerm Term Bool
cond Term ty
l Term ty
r) =
String
"ITE{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", cond="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
cond
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", then="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
l
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", else="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
r
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(AddNumTerm Term ty
arg1 Term ty
arg2) =
String
"AddNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(NegNumTerm Term ty
arg) =
String
"NegNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(MulNumTerm Term ty
arg1 Term ty
arg2) =
String
"MulNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(AbsNumTerm Term ty
arg) =
String
"AbsNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(SignumNumTerm Term ty
arg) =
String
"SignumNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(LtOrdTerm Term t
arg1 Term t
arg2) =
String
"LTNum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(LeOrdTerm Term t
arg1 Term t
arg2) =
String
"LENum{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(AndBitsTerm Term ty
arg1 Term ty
arg2) =
String
"AndBits{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(OrBitsTerm Term ty
arg1 Term ty
arg2) =
String
"OrBits{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(XorBitsTerm Term ty
arg1 Term ty
arg2) =
String
"XorBits{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ComplementBitsTerm Term ty
arg) =
String
"ComplementBits{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ShiftLeftTerm Term ty
arg Term ty
n) =
String
"ShiftLeft{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ShiftRightTerm Term ty
arg Term ty
n) =
String
"ShiftRight{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(RotateLeftTerm Term ty
arg Term ty
n) =
String
"RotateLeft{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(RotateRightTerm Term ty
arg Term ty
n) =
String
"RotateRight{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(BitCastTerm Term a
arg) =
String
"BitCast{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(BitCastOrTerm Term ty
arg Term a
d) =
String
"BitCastOr{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", default="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
d
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(BVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2) =
String
"BVConcat{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall a. Show a => a -> String
show Term (bv l)
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv r) -> String
forall a. Show a => a -> String
show Term (bv r)
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(BVSelectTerm Proxy ix
ix Proxy w
w Term (bv n)
arg) =
String
"BVSelect{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", ix="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Natural -> String
forall a. Show a => a -> String
show (Proxy ix -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy ix
ix)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", w="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Natural -> String
forall a. Show a => a -> String
show (Proxy w -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy w
w)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv n) -> String
forall a. Show a => a -> String
show Term (bv n)
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(BVExtendTerm Bool
signed Proxy r
n Term (bv l)
arg) =
String
"BVExtend{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", signed="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Bool -> String
forall a. Show a => a -> String
show Bool
signed
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Natural -> String
forall a. Show a => a -> String
show (Proxy r -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy r
n)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall a. Show a => a -> String
show Term (bv l)
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ApplyTerm Term f
func Term a
arg) =
String
"Apply{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", f="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term f -> String
forall a. Show a => a -> String
show Term f
func
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(DivIntegralTerm Term ty
arg1 Term ty
arg2) =
String
"DivIntegral{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ModIntegralTerm Term ty
arg1 Term ty
arg2) =
String
"ModIntegral{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(QuotIntegralTerm Term ty
arg1 Term ty
arg2) =
String
"QuotIntegral{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(RemIntegralTerm Term ty
arg1 Term ty
arg2) =
String
"RemIntegral{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPTraitTerm FPTrait
trait Term (fp eb sb)
arg) =
String
"FPTrait{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", trait="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPTrait -> String
forall a. Show a => a -> String
show FPTrait
trait
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FdivTerm Term ty
arg1 Term ty
arg2) =
String
"Fdiv{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(RecipTerm Term ty
arg) =
String
"Recip{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FloatingUnaryTerm FloatingUnaryOp
op Term ty
arg) =
String
"FloatingUnary{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FloatingUnaryOp -> String
forall a. Show a => a -> String
show FloatingUnaryOp
op
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(PowerTerm Term ty
arg1 Term ty
arg2) =
String
"Power{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPUnaryTerm FPUnaryOp
op Term (fp eb sb)
arg) =
String
"FPUnary{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPUnaryOp -> String
forall a. Show a => a -> String
show FPUnaryOp
op
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPBinaryTerm FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
String
"FPBinary{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPBinaryOp -> String
forall a. Show a => a -> String
show FPBinaryOp
op
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg) =
String
"FPRoundingUnary{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingUnaryOp -> String
forall a. Show a => a -> String
show FPRoundingUnaryOp
op
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
String
"FPRoundingBinary{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingBinaryOp -> String
forall a. Show a => a -> String
show FPRoundingBinaryOp
op
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3) =
String
"FPFMA{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg1
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg2
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg3="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (fp eb sb) -> String
forall a. Show a => a -> String
show Term (fp eb sb)
arg3
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FromIntegralTerm Term a
arg) =
String
"FromIntegral{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(FromFPOrTerm Term ty
arg Term FPRoundingMode
d Term (FP eb sb)
mode) =
String
"FromFPTerm{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", default="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
d
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
mode
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
show t :: Term ty
t@(ToFPTerm Term FPRoundingMode
arg Term a
mode Proxy eb
_ Proxy sb
_) =
String
"ToFPTerm{tid="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show (Term ty -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show (Term ty -> Digest
forall t. Term t -> Digest
termId Term ty
t)
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
mode
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
arg
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
prettyPrintTerm :: Term t -> Doc ann
prettyPrintTerm :: forall t ann. Term t -> Doc ann
prettyPrintTerm v :: Term t
v@Term t
SupportedTerm =
(Int -> Doc ann) -> Doc ann
forall ann. (Int -> Doc ann) -> Doc ann
column
( \Int
c ->
(PageWidth -> Doc ann) -> Doc ann
forall ann. (PageWidth -> Doc ann) -> Doc ann
pageWidth ((PageWidth -> Doc ann) -> Doc ann)
-> (PageWidth -> Doc ann) -> Doc ann
forall a b. (a -> b) -> a -> b
$ \case
AvailablePerLine Int
i Double
r ->
if Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
c Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
len) Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
r
then Doc ann
"..."
else String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
formatted
PageWidth
Unbounded -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
formatted
)
where
formatted :: String
formatted = Term t -> String
forall t. Term t -> String
pformatTerm Term t
v
len :: Int
len = String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
formatted
instance (SupportedPrim t) => Eq (Term t) where
Term t
a == :: Term t -> Term t -> Bool
== Term t
b =
if Term t -> WeakThreadId
forall t. Interned t => t -> WeakThreadId
threadId Term t
a WeakThreadId -> WeakThreadId -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> WeakThreadId
forall t. Interned t => t -> WeakThreadId
threadId Term t
b
then Term t -> Digest
forall t. Term t -> Digest
termId Term t
a Digest -> Digest -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Digest
forall t. Term t -> Digest
termId Term t
b
else IO Bool -> Bool
forall a. IO a -> a
unsafePerformIO (IO Bool -> Bool) -> IO Bool -> Bool
forall a b. (a -> b) -> a -> b
$ do
tid <- IO WeakThreadId
myWeakThreadId
a' <- toCurThreadImpl tid a
b' <- toCurThreadImpl tid b
return $ a' == b'
instance (SupportedPrim t) => Hashable (Term t) where
hashWithSalt :: Int -> Term t -> Int
hashWithSalt Int
s Term t
t = Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (HashId -> Int) -> HashId -> Int
forall a b. (a -> b) -> a -> b
$ Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
t
{-# INLINE hashWithSalt #-}
data UTerm t where
UConTerm :: (SupportedPrim t) => !t -> UTerm t
USymTerm :: !(TypedSymbol 'AnyKind t) -> UTerm t
UForallTerm ::
!(TypedSymbol 'ConstantKind t) ->
!(Term Bool) ->
UTerm Bool
UExistsTerm ::
!(TypedSymbol 'ConstantKind t) ->
!(Term Bool) ->
UTerm Bool
UNotTerm :: !(Term Bool) -> UTerm Bool
UOrTerm :: !(Term Bool) -> !(Term Bool) -> !(HS.HashSet (Term Bool)) -> UTerm Bool
UAndTerm :: !(Term Bool) -> !(Term Bool) -> !(HS.HashSet (Term Bool)) -> UTerm Bool
UEqTerm :: !(Term t) -> !(Term t) -> UTerm Bool
UDistinctTerm :: !(NonEmpty (Term t)) -> UTerm Bool
UITETerm ::
(SupportedPrim t) =>
!(Term Bool) ->
!(Term t) ->
!(Term t) ->
UTerm t
UAddNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> !(Term t) -> UTerm t
UNegNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
UMulNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> !(Term t) -> UTerm t
UAbsNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
USignumNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
ULtOrdTerm :: (SupportedPrim t, PEvalOrdTerm t) => !(Term t) -> !(Term t) -> UTerm Bool
ULeOrdTerm :: (SupportedPrim t, PEvalOrdTerm t) => !(Term t) -> !(Term t) -> UTerm Bool
UAndBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
UOrBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
UXorBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
UComplementBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> UTerm t
UShiftLeftTerm ::
(SupportedPrim t, PEvalShiftTerm t) => !(Term t) -> !(Term t) -> UTerm t
UShiftRightTerm ::
(SupportedPrim t, PEvalShiftTerm t) => !(Term t) -> !(Term t) -> UTerm t
URotateLeftTerm ::
(SupportedPrim t, PEvalRotateTerm t) => !(Term t) -> !(Term t) -> UTerm t
URotateRightTerm ::
(SupportedPrim t, PEvalRotateTerm t) => !(Term t) -> !(Term t) -> UTerm t
UBitCastTerm ::
(SupportedPrim b, PEvalBitCastTerm a b) =>
!(Term a) ->
UTerm b
UBitCastOrTerm ::
(SupportedPrim b, PEvalBitCastOrTerm a b) =>
!(Term b) ->
!(Term a) ->
UTerm b
UBVConcatTerm ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r,
SupportedPrim (bv (l + r))
) =>
!(Term (bv l)) ->
!(Term (bv r)) ->
UTerm (bv (l + r))
UBVSelectTerm ::
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
SupportedPrim (bv w)
) =>
!(Proxy ix) ->
!(Proxy w) ->
!(Term (bv n)) ->
UTerm (bv w)
UBVExtendTerm ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
!Bool ->
!(Proxy r) ->
!(Term (bv l)) ->
UTerm (bv r)
UApplyTerm ::
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f ->
Term a ->
UTerm b
UDivIntegralTerm ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
!(Term t) ->
!(Term t) ->
UTerm t
UModIntegralTerm ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
!(Term t) ->
!(Term t) ->
UTerm t
UQuotIntegralTerm ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
!(Term t) ->
!(Term t) ->
UTerm t
URemIntegralTerm ::
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
!(Term t) ->
!(Term t) ->
UTerm t
UFPTraitTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!FPTrait ->
!(Term (fp eb sb)) ->
UTerm Bool
UFdivTerm ::
(SupportedPrim t, PEvalFractionalTerm t) =>
!(Term t) ->
!(Term t) ->
UTerm t
URecipTerm :: (SupportedPrim t, PEvalFractionalTerm t) => !(Term t) -> UTerm t
UFloatingUnaryTerm ::
(SupportedPrim t, PEvalFloatingTerm t) =>
!FloatingUnaryOp ->
!(Term t) ->
UTerm t
UPowerTerm ::
(SupportedPrim t, PEvalFloatingTerm t) => !(Term t) -> !(Term t) -> UTerm t
UFPUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!FPUnaryOp ->
!(Term (fp eb sb)) ->
UTerm (fp eb sb)
UFPBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!FPBinaryOp ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
UTerm (fp eb sb)
UFPRoundingUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!FPRoundingUnaryOp ->
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
UTerm (fp eb sb)
UFPRoundingBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!FPRoundingBinaryOp ->
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
UTerm (fp eb sb)
UFPFMATerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
!(Term FPRoundingMode) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
!(Term (fp eb sb)) ->
UTerm (fp eb sb)
UFromIntegralTerm ::
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
!(Term a) ->
UTerm b
UFromFPOrTerm ::
( PEvalIEEEFPConvertibleTerm a,
SupportedPrim a,
ValidFP eb sb
) =>
Term a ->
!(Term FPRoundingMode) ->
!(Term (FP eb sb)) ->
UTerm a
UToFPTerm ::
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim (FP eb sb)
) =>
!(Term FPRoundingMode) ->
!(Term a) ->
Proxy eb ->
Proxy sb ->
UTerm (FP eb sb)
eqHeteroSymbol :: forall ta a tb b. TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol :: forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol (TypedSymbol Symbol
taga) (TypedSymbol Symbol
tagb) =
case TypeRep a -> TypeRep b -> Maybe (a :~~: b)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @a) (forall t. SupportedPrim t => TypeRep t
primTypeRep @b) of
Just a :~~: b
HRefl -> Symbol
taga Symbol -> Symbol -> Bool
forall a. Eq a => a -> a -> Bool
== Symbol
tagb
Maybe (a :~~: b)
Nothing -> Bool
False
{-# INLINE eqHeteroSymbol #-}
preHashConDescription :: (SupportedPrim t) => t -> Digest
preHashConDescription :: forall t. SupportedPrim t => t -> Digest
preHashConDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (t -> Int) -> t -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> t -> Int
forall t. SupportedPrim t => Int -> t -> Int
hashConWithSalt Int
0
{-# INLINE preHashConDescription #-}
preHashSymDescription :: TypedSymbol 'AnyKind t -> Digest
preHashSymDescription :: forall t. TypedSymbol 'AnyKind t -> Digest
preHashSymDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest)
-> (TypedSymbol 'AnyKind t -> Int)
-> TypedSymbol 'AnyKind t
-> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypedSymbol 'AnyKind t -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
1
{-# INLINE preHashSymDescription #-}
preHashForallDescription ::
TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription :: forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription TypedSymbol 'ConstantKind t
sym HashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
( Int
2
Int -> TypedSymbol 'ConstantKind t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol 'ConstantKind t
sym
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h
)
{-# INLINE preHashForallDescription #-}
preHashExistsDescription ::
TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription :: forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription TypedSymbol 'ConstantKind t
sym HashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
( Int
3
Int -> TypedSymbol 'ConstantKind t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol 'ConstantKind t
sym
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h
)
{-# INLINE preHashExistsDescription #-}
preHashNotDescription :: HashId -> Digest
preHashNotDescription :: HashId -> Digest
preHashNotDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
7
{-# INLINE preHashNotDescription #-}
preHashOrDescription :: HashId -> HashId -> Digest
preHashOrDescription :: HashId -> HashId -> Digest
preHashOrDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
8 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashOrDescription #-}
preHashAndDescription :: HashId -> HashId -> Digest
preHashAndDescription :: HashId -> HashId -> Digest
preHashAndDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
9 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAndDescription #-}
preHashEqDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription Fingerprint
tp HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
10 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashEqDescription #-}
preHashDistinctDescription :: Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription :: Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription Fingerprint
tp NonEmpty HashId
hs =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
11 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> NonEmpty HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` NonEmpty HashId
hs)
{-# INLINE preHashDistinctDescription #-}
preHashITEDescription :: HashId -> HashId -> HashId -> Digest
preHashITEDescription :: HashId -> HashId -> HashId -> Digest
preHashITEDescription HashId
h1 HashId
h2 HashId
h3 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
12 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h3)
{-# INLINE preHashITEDescription #-}
preHashAddNumDescription :: HashId -> HashId -> Digest
preHashAddNumDescription :: HashId -> HashId -> Digest
preHashAddNumDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
13 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAddNumDescription #-}
preHashNegNumDescription :: HashId -> Digest
preHashNegNumDescription :: HashId -> Digest
preHashNegNumDescription =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
14
{-# INLINE preHashNegNumDescription #-}
preHashMulNumDescription :: HashId -> HashId -> Digest
preHashMulNumDescription :: HashId -> HashId -> Digest
preHashMulNumDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
15 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashMulNumDescription #-}
preHashAbsNumDescription :: HashId -> Digest
preHashAbsNumDescription :: HashId -> Digest
preHashAbsNumDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
16
{-# INLINE preHashAbsNumDescription #-}
preHashSignumNumDescription :: HashId -> Digest
preHashSignumNumDescription :: HashId -> Digest
preHashSignumNumDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
17
{-# INLINE preHashSignumNumDescription #-}
preHashLtOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription Fingerprint
tp HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
18 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashLtOrdDescription #-}
preHashLeOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription Fingerprint
tp HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
19 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashLeOrdDescription #-}
preHashAndBitsDescription :: HashId -> HashId -> Digest
preHashAndBitsDescription :: HashId -> HashId -> Digest
preHashAndBitsDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
20 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAndBitsDescription #-}
preHashOrBitsDescription :: HashId -> HashId -> Digest
preHashOrBitsDescription :: HashId -> HashId -> Digest
preHashOrBitsDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
21 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashOrBitsDescription #-}
preHashXorBitsDescription :: HashId -> HashId -> Digest
preHashXorBitsDescription :: HashId -> HashId -> Digest
preHashXorBitsDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
22 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashXorBitsDescription #-}
preHashComplementBitsDescription :: HashId -> Digest
preHashComplementBitsDescription :: HashId -> Digest
preHashComplementBitsDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
23
{-# INLINE preHashComplementBitsDescription #-}
preHashShiftLeftDescription :: HashId -> HashId -> Digest
preHashShiftLeftDescription :: HashId -> HashId -> Digest
preHashShiftLeftDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
24 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashShiftLeftDescription #-}
preHashShiftRightDescription :: HashId -> HashId -> Digest
preHashShiftRightDescription :: HashId -> HashId -> Digest
preHashShiftRightDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
25 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashShiftRightDescription #-}
preHashRotateLeftDescription :: HashId -> HashId -> Digest
preHashRotateLeftDescription :: HashId -> HashId -> Digest
preHashRotateLeftDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
26 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRotateLeftDescription #-}
preHashRotateRightDescription :: HashId -> HashId -> Digest
preHashRotateRightDescription :: HashId -> HashId -> Digest
preHashRotateRightDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
27 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRotateRightDescription #-}
preHashBVConcatDescription :: TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription :: TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription TypeHashId
h1 TypeHashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
( Int
28
Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h1
Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2
)
preHashBVSelectDescription :: Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription :: Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription Fingerprint
tp TypeHashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
29 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)
preHashBVExtendDescription :: Bool -> TypeHashId -> Digest
preHashBVExtendDescription :: Bool -> TypeHashId -> Digest
preHashBVExtendDescription Bool
signed TypeHashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
30 Int -> Bool -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Bool
signed Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)
preHashBitCastDescription :: TypeHashId -> Digest
preHashBitCastDescription :: TypeHashId -> Digest
preHashBitCastDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (TypeHashId -> Int) -> TypeHashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
31
{-# INLINE preHashBitCastDescription #-}
preHashBitCastOrDescription :: HashId -> TypeHashId -> Digest
preHashBitCastOrDescription :: HashId -> TypeHashId -> Digest
preHashBitCastOrDescription HashId
h1 TypeHashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
32 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashBitCastOrDescription #-}
preHashApplyDescription :: TypeHashId -> TypeHashId -> Digest
preHashApplyDescription :: TypeHashId -> TypeHashId -> Digest
preHashApplyDescription TypeHashId
h1 TypeHashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
33 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashApplyDescription #-}
preHashDivIntegralDescription :: HashId -> HashId -> Digest
preHashDivIntegralDescription :: HashId -> HashId -> Digest
preHashDivIntegralDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
34 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashDivIntegralDescription #-}
preHashModIntegralDescription :: HashId -> HashId -> Digest
preHashModIntegralDescription :: HashId -> HashId -> Digest
preHashModIntegralDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
35 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashModIntegralDescription #-}
preHashQuotIntegralDescription :: HashId -> HashId -> Digest
preHashQuotIntegralDescription :: HashId -> HashId -> Digest
preHashQuotIntegralDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
36 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashQuotIntegralDescription #-}
preHashRemIntegralDescription :: HashId -> HashId -> Digest
preHashRemIntegralDescription :: HashId -> HashId -> Digest
preHashRemIntegralDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
37 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRemIntegralDescription #-}
preHashFPTraitDescription :: FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription :: FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription FPTrait
trait TypeHashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
38 Int -> FPTrait -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPTrait
trait Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)
{-# INLINE preHashFPTraitDescription #-}
preHashFdivDescription :: HashId -> HashId -> Digest
preHashFdivDescription :: HashId -> HashId -> Digest
preHashFdivDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
39 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashFdivDescription #-}
preHashRecipDescription :: HashId -> Digest
preHashRecipDescription :: HashId -> Digest
preHashRecipDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
40
{-# INLINE preHashRecipDescription #-}
preHashFloatingUnaryDescription :: FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription :: FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription FloatingUnaryOp
op HashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
41 Int -> FloatingUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FloatingUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFloatingUnaryDescription #-}
preHashPowerDescription :: HashId -> HashId -> Digest
preHashPowerDescription :: HashId -> HashId -> Digest
preHashPowerDescription HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
42 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashPowerDescription #-}
preHashFPUnaryDescription :: FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription :: FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription FPUnaryOp
op HashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
43 Int -> FPUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFPUnaryDescription #-}
preHashFPBinaryDescription :: FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription :: FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription FPBinaryOp
op HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
44 Int -> FPBinaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPBinaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashFPBinaryDescription #-}
preHashFPRoundingUnaryDescription ::
FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription :: FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription FPRoundingUnaryOp
op HashId
mode HashId
h =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
45 Int -> FPRoundingUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPRoundingUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFPRoundingUnaryDescription #-}
preHashFPRoundingBinaryDescription ::
FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription :: FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription FPRoundingBinaryOp
op HashId
mode HashId
h1 HashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
( Int
46
Int -> FPRoundingBinaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPRoundingBinaryOp
op
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2
)
preHashFPFMADescription ::
HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription :: HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription HashId
mode HashId
h1 HashId
h2 HashId
h3 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
( Int
47
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2
Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h3
)
{-# INLINE preHashFPFMADescription #-}
preHashFromIntegralDescription :: TypeHashId -> Digest
preHashFromIntegralDescription :: TypeHashId -> Digest
preHashFromIntegralDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (TypeHashId -> Int) -> TypeHashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
48
{-# INLINE preHashFromIntegralDescription #-}
preHashFromFPOrDescription ::
HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription :: HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription HashId
h1 HashId
h2 TypeHashId
h3 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
49 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h3)
{-# INLINE preHashFromFPOrDescription #-}
preHashToFPTermDescription :: HashId -> TypeHashId -> Digest
preHashToFPTermDescription :: HashId -> TypeHashId -> Digest
preHashToFPTermDescription HashId
h1 TypeHashId
h2 =
Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
50 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashToFPTermDescription #-}
instance Interned (Term t) where
type Uninterned (Term t) = UTerm t
data Description (Term t) where
DConTerm ::
(t -> t -> Bool) -> {-# UNPACK #-} !Digest -> t -> Description (Term t)
DSymTerm ::
{-# UNPACK #-} !Digest ->
TypedSymbol 'AnyKind t ->
Description (Term t)
DForallTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !(TypedSymbol 'ConstantKind t) ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DExistsTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !(TypedSymbol 'ConstantKind t) ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DNotTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DOrTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
!(HS.HashSet (Term Bool)) ->
Description (Term Bool)
DAndTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
!(HS.HashSet (Term Bool)) ->
Description (Term Bool)
DEqTerm ::
{-# UNPACK #-} !Digest ->
Fingerprint ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DDistinctTerm ::
{-# UNPACK #-} !Digest ->
Fingerprint ->
!(NonEmpty HashId) ->
Description (Term Bool)
DITETerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DAddNumTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DNegNumTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DMulNumTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DAbsNumTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DSignumNumTerm ::
{-# UNPACK #-} !Digest -> {-# UNPACK #-} !HashId -> Description (Term t)
DLtOrdTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !Fingerprint ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DLeOrdTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !Fingerprint ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term Bool)
DAndBitsTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DOrBitsTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DXorBitsTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DComplementBitsTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DShiftLeftTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DShiftRightTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DRotateLeftTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DRotateRightTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term t)
DBVConcatTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !TypeHashId ->
{-# UNPACK #-} !TypeHashId ->
Description (Term t)
DBitCastTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !TypeHashId ->
Description (Term b)
DBitCastOrTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !TypeHashId ->
Description (Term b)
DBVSelectTerm ::
forall bv (w :: Nat).
{-# UNPACK #-} !Digest ->
!Fingerprint ->
{-# UNPACK #-} !TypeHashId ->
Description (Term (bv w))
DBVExtendTerm ::
forall bv (r :: Nat).
{-# UNPACK #-} !Digest ->
!Bool ->
!(Proxy r) ->
{-# UNPACK #-} !TypeHashId ->
Description (Term (bv r))
DApplyTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !TypeHashId ->
{-# UNPACK #-} !TypeHashId ->
Description (Term b)
DDivIntegralTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DModIntegralTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DQuotIntegralTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DRemIntegralTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DFPTraitTerm ::
{-# UNPACK #-} !Digest ->
FPTrait ->
{-# UNPACK #-} !TypeHashId ->
Description (Term Bool)
DFdivTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DRecipTerm ::
{-# UNPACK #-} !Digest -> {-# UNPACK #-} !HashId -> Description (Term a)
DFloatingUnaryTerm ::
{-# UNPACK #-} !Digest ->
FloatingUnaryOp ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DPowerTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term a)
DFPUnaryTerm ::
forall fp (eb :: Nat) (sb :: Nat).
{-# UNPACK #-} !Digest ->
FPUnaryOp ->
{-# UNPACK #-} !HashId ->
Description (Term (fp eb sb))
DFPBinaryTerm ::
forall fp (eb :: Nat) (sb :: Nat).
{-# UNPACK #-} !Digest ->
FPBinaryOp ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term (fp eb sb))
DFPRoundingUnaryTerm ::
forall fp (eb :: Nat) (sb :: Nat).
{-# UNPACK #-} !Digest ->
FPRoundingUnaryOp ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term (fp eb sb))
DFPRoundingBinaryTerm ::
forall fp (eb :: Nat) (sb :: Nat).
{-# UNPACK #-} !Digest ->
FPRoundingBinaryOp ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term (fp eb sb))
DFPFMATerm ::
forall fp (eb :: Nat) (sb :: Nat).
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
Description (Term (fp eb sb))
DFromIntegralTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !TypeHashId ->
Description (Term b)
DFromFPOrTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !TypeHashId ->
Description (Term a)
DToFPTerm ::
{-# UNPACK #-} !Digest ->
{-# UNPACK #-} !HashId ->
{-# UNPACK #-} !TypeHashId ->
Description (Term (FP eb sb))
describe :: Uninterned (Term t) -> Description (Term t)
describe (UConTerm t
v) = (t -> t -> Bool) -> Digest -> t -> Description (Term t)
forall t. (t -> t -> Bool) -> Digest -> t -> Description (Term t)
DConTerm t -> t -> Bool
forall t. SupportedPrim t => t -> t -> Bool
sameCon (t -> Digest
forall t. SupportedPrim t => t -> Digest
preHashConDescription t
v) t
v
describe ((USymTerm TypedSymbol 'AnyKind t
name) :: UTerm t) =
forall t. Digest -> TypedSymbol 'AnyKind t -> Description (Term t)
DSymTerm @t (TypedSymbol 'AnyKind t -> Digest
forall t. TypedSymbol 'AnyKind t -> Digest
preHashSymDescription TypedSymbol 'AnyKind t
name) TypedSymbol 'AnyKind t
name
describe (UForallTerm (TypedSymbol 'ConstantKind t
sym :: TypedSymbol 'ConstantKind arg) Term Bool
arg) =
let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg
in Digest
-> TypedSymbol 'ConstantKind t -> HashId -> Description (Term Bool)
forall bv.
Digest
-> TypedSymbol 'ConstantKind bv
-> HashId
-> Description (Term Bool)
DForallTerm (TypedSymbol 'ConstantKind t -> HashId -> Digest
forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription TypedSymbol 'ConstantKind t
sym HashId
argHashId) TypedSymbol 'ConstantKind t
sym HashId
argHashId
describe (UExistsTerm (TypedSymbol 'ConstantKind t
sym :: TypedSymbol 'ConstantKind arg) Term Bool
arg) =
let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg
in Digest
-> TypedSymbol 'ConstantKind t -> HashId -> Description (Term Bool)
forall bv.
Digest
-> TypedSymbol 'ConstantKind bv
-> HashId
-> Description (Term Bool)
DExistsTerm (TypedSymbol 'ConstantKind t -> HashId -> Digest
forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription TypedSymbol 'ConstantKind t
sym HashId
argHashId) TypedSymbol 'ConstantKind t
sym HashId
argHashId
describe (UNotTerm Term Bool
arg) =
let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg
in Digest -> HashId -> Description (Term Bool)
DNotTerm (HashId -> Digest
preHashNotDescription HashId
argHashId) HashId
argHashId
describe (UOrTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) =
let arg1HashId :: HashId
arg1HashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg1
arg2HashId :: HashId
arg2HashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg2
in Digest
-> HashId
-> HashId
-> HashSet (Term Bool)
-> Description (Term Bool)
DOrTerm
(HashId -> HashId -> Digest
preHashOrDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
HashSet (Term Bool)
s
describe (UAndTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) =
let arg1HashId :: HashId
arg1HashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg1
arg2HashId :: HashId
arg2HashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
arg2
in Digest
-> HashId
-> HashId
-> HashSet (Term Bool)
-> Description (Term Bool)
DAndTerm
(HashId -> HashId -> Digest
preHashAndDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
HashSet (Term Bool)
s
describe (UEqTerm (arg1 :: Term t
arg1@Term t
SupportedTerm :: Term arg) Term t
arg2) = do
let fingerprint :: Fingerprint
fingerprint = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DEqTerm
(Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription Fingerprint
fingerprint HashId
arg1HashId HashId
arg2HashId)
Fingerprint
fingerprint
HashId
arg1HashId
HashId
arg2HashId
describe (UDistinctTerm args :: NonEmpty (Term t)
args@((Term t
SupportedTerm :: Term arg) :| [Term t]
_)) =
let fingerprint :: Fingerprint
fingerprint = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
argsHashId :: NonEmpty HashId
argsHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId (Term t -> HashId) -> NonEmpty (Term t) -> NonEmpty HashId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Term t)
args
in Digest -> Fingerprint -> NonEmpty HashId -> Description (Term Bool)
DDistinctTerm
(Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription Fingerprint
fingerprint NonEmpty HashId
argsHashId)
Fingerprint
fingerprint
NonEmpty HashId
argsHashId
describe (UITETerm Term Bool
cond (Term t
l :: Term arg) Term t
r) =
let condHashId :: HashId
condHashId = Term Bool -> HashId
forall t. Term t -> HashId
termHashId Term Bool
cond
lHashId :: HashId
lHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
l
rHashId :: HashId
rHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
r
in Digest -> HashId -> HashId -> HashId -> Description (Term t)
forall t.
Digest -> HashId -> HashId -> HashId -> Description (Term t)
DITETerm
(HashId -> HashId -> HashId -> Digest
preHashITEDescription HashId
condHashId HashId
lHashId HashId
rHashId)
HashId
condHashId
HashId
lHashId
HashId
rHashId
describe (UAddNumTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DAddNumTerm
(HashId -> HashId -> Digest
preHashAddNumDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UNegNumTerm Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DNegNumTerm (HashId -> Digest
preHashNegNumDescription HashId
argHashId) HashId
argHashId
describe (UMulNumTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DMulNumTerm
(HashId -> HashId -> Digest
preHashMulNumDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UAbsNumTerm Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DAbsNumTerm (HashId -> Digest
preHashAbsNumDescription HashId
argHashId) HashId
argHashId
describe (USignumNumTerm Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DSignumNumTerm (HashId -> Digest
preHashSignumNumDescription HashId
argHashId) HashId
argHashId
describe (ULtOrdTerm (Term t
arg1 :: Term arg) Term t
arg2) =
let tr :: Fingerprint
tr = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DLtOrdTerm
(Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription Fingerprint
tr HashId
arg1HashId HashId
arg2HashId)
Fingerprint
tr
HashId
arg1HashId
HashId
arg2HashId
describe (ULeOrdTerm (Term t
arg1 :: Term arg) Term t
arg2) =
let tr :: Fingerprint
tr = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DLeOrdTerm
(Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription Fingerprint
tr HashId
arg1HashId HashId
arg2HashId)
Fingerprint
tr
HashId
arg1HashId
HashId
arg2HashId
describe (UAndBitsTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DAndBitsTerm
(HashId -> HashId -> Digest
preHashAndBitsDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UOrBitsTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DOrBitsTerm
(HashId -> HashId -> Digest
preHashOrBitsDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UXorBitsTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DXorBitsTerm
(HashId -> HashId -> Digest
preHashXorBitsDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UComplementBitsTerm Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DComplementBitsTerm
(HashId -> Digest
preHashComplementBitsDescription HashId
argHashId)
HashId
argHashId
describe (UShiftLeftTerm Term t
arg Term t
n) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
n
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DShiftLeftTerm
(HashId -> HashId -> Digest
preHashShiftLeftDescription HashId
argHashId HashId
nHashId)
HashId
argHashId
HashId
nHashId
describe (UShiftRightTerm Term t
arg Term t
n) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
n
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DShiftRightTerm
(HashId -> HashId -> Digest
preHashShiftRightDescription HashId
argHashId HashId
nHashId)
HashId
argHashId
HashId
nHashId
describe (URotateLeftTerm Term t
arg Term t
n) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
n
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRotateLeftTerm
(HashId -> HashId -> Digest
preHashRotateLeftDescription HashId
argHashId HashId
nHashId)
HashId
argHashId
HashId
nHashId
describe (URotateRightTerm Term t
arg Term t
n) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
n
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRotateRightTerm
(HashId -> HashId -> Digest
preHashRotateRightDescription HashId
argHashId HashId
nHashId)
HashId
argHashId
HashId
nHashId
describe (UBitCastTerm (Term a
arg :: Term a)) =
let argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term a
arg
in Digest -> TypeHashId -> Description (Term t)
forall b. Digest -> TypeHashId -> Description (Term b)
DBitCastTerm (TypeHashId -> Digest
preHashBitCastDescription TypeHashId
argHashId) TypeHashId
argHashId
describe (UBitCastOrTerm Term t
d (Term a
arg :: Term a)) =
let dHashId :: HashId
dHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
d
argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term a
arg
in Digest -> HashId -> TypeHashId -> Description (Term t)
forall b. Digest -> HashId -> TypeHashId -> Description (Term b)
DBitCastOrTerm
(HashId -> TypeHashId -> Digest
preHashBitCastOrDescription HashId
dHashId TypeHashId
argHashId)
HashId
dHashId
TypeHashId
argHashId
describe (UBVConcatTerm (Term (bv l)
arg1 :: Term bv1) (Term (bv r)
arg2 :: Term bv2)) =
let arg1HashId :: TypeHashId
arg1HashId = Term (bv l) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (bv l)
arg1
arg2HashId :: TypeHashId
arg2HashId = Term (bv r) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (bv r)
arg2
in Digest -> TypeHashId -> TypeHashId -> Description (Term t)
forall t.
Digest -> TypeHashId -> TypeHashId -> Description (Term t)
DBVConcatTerm
(TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription TypeHashId
arg1HashId TypeHashId
arg2HashId)
TypeHashId
arg1HashId
TypeHashId
arg2HashId
describe (UBVSelectTerm (Proxy ix
ix :: Proxy ix) Proxy w
_ (Term (bv n)
arg :: Term arg)) =
let ixFingerprint :: Fingerprint
ixFingerprint = SomeTypeRep -> Fingerprint
typeRepFingerprint (SomeTypeRep -> Fingerprint) -> SomeTypeRep -> Fingerprint
forall a b. (a -> b) -> a -> b
$ Proxy ix -> SomeTypeRep
forall {k} (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> SomeTypeRep
someTypeRep Proxy ix
ix
argHashId :: TypeHashId
argHashId = Term (bv n) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (bv n)
arg
in Digest -> Fingerprint -> TypeHashId -> Description (Term (bv w))
forall (bv :: Natural -> *) (n :: Natural).
Digest -> Fingerprint -> TypeHashId -> Description (Term (bv n))
DBVSelectTerm
(Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription Fingerprint
ixFingerprint TypeHashId
argHashId)
Fingerprint
ixFingerprint
TypeHashId
argHashId
describe (UBVExtendTerm Bool
signed (Proxy r
n :: Proxy n) (Term (bv l)
arg :: Term arg)) =
let argHashId :: TypeHashId
argHashId = Term (bv l) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (bv l)
arg
in Digest
-> Bool -> Proxy r -> TypeHashId -> Description (Term (bv r))
forall (bv :: Natural -> *) (n :: Natural).
Digest
-> Bool -> Proxy n -> TypeHashId -> Description (Term (bv n))
DBVExtendTerm
(Bool -> TypeHashId -> Digest
preHashBVExtendDescription Bool
signed TypeHashId
argHashId)
Bool
signed
Proxy r
n
TypeHashId
argHashId
describe (UApplyTerm (Term f
f :: Term f) (Term a
arg :: Term a)) =
let fHashId :: TypeHashId
fHashId = Term f -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term f
f
argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term a
arg
in Digest -> TypeHashId -> TypeHashId -> Description (Term t)
forall t.
Digest -> TypeHashId -> TypeHashId -> Description (Term t)
DApplyTerm
(TypeHashId -> TypeHashId -> Digest
preHashApplyDescription TypeHashId
fHashId TypeHashId
argHashId)
TypeHashId
fHashId
TypeHashId
argHashId
describe (UDivIntegralTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DDivIntegralTerm
(HashId -> HashId -> Digest
preHashDivIntegralDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UModIntegralTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DModIntegralTerm
(HashId -> HashId -> Digest
preHashModIntegralDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UQuotIntegralTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DQuotIntegralTerm
(HashId -> HashId -> Digest
preHashQuotIntegralDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (URemIntegralTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRemIntegralTerm
(HashId -> HashId -> Digest
preHashRemIntegralDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UFPTraitTerm FPTrait
trait (Term (fp eb sb)
arg :: Term arg)) =
let argHashId :: TypeHashId
argHashId = Term (fp eb sb) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (fp eb sb)
arg
in Digest -> FPTrait -> TypeHashId -> Description (Term Bool)
DFPTraitTerm
(FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription FPTrait
trait TypeHashId
argHashId)
FPTrait
trait
TypeHashId
argHashId
describe (UFdivTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DFdivTerm
(HashId -> HashId -> Digest
preHashFdivDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (URecipTerm Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DRecipTerm (HashId -> Digest
preHashRecipDescription HashId
argHashId) HashId
argHashId
describe (UFloatingUnaryTerm FloatingUnaryOp
op Term t
arg) =
let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg
in Digest -> FloatingUnaryOp -> HashId -> Description (Term t)
forall a.
Digest -> FloatingUnaryOp -> HashId -> Description (Term a)
DFloatingUnaryTerm
(FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription FloatingUnaryOp
op HashId
argHashId)
FloatingUnaryOp
op
HashId
argHashId
describe (UPowerTerm Term t
arg1 Term t
arg2) =
let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg1
arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
arg2
in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DPowerTerm
(HashId -> HashId -> Digest
preHashPowerDescription HashId
arg1HashId HashId
arg2HashId)
HashId
arg1HashId
HashId
arg2HashId
describe (UFPUnaryTerm FPUnaryOp
op Term (fp eb sb)
arg) =
let argHashId :: HashId
argHashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg
in Digest -> FPUnaryOp -> HashId -> Description (Term (fp eb sb))
forall (bv :: Natural -> Natural -> *) (n :: Natural)
(sb :: Natural).
Digest -> FPUnaryOp -> HashId -> Description (Term (bv n sb))
DFPUnaryTerm
(FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription FPUnaryOp
op HashId
argHashId)
FPUnaryOp
op
HashId
argHashId
describe (UFPBinaryTerm FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
let arg1HashId :: HashId
arg1HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg1
arg2HashId :: HashId
arg2HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg2
in Digest
-> FPBinaryOp -> HashId -> HashId -> Description (Term (fp eb sb))
forall (bv :: Natural -> Natural -> *) (n :: Natural)
(sb :: Natural).
Digest
-> FPBinaryOp -> HashId -> HashId -> Description (Term (bv n sb))
DFPBinaryTerm
(FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription FPBinaryOp
op HashId
arg1HashId HashId
arg2HashId)
FPBinaryOp
op
HashId
arg1HashId
HashId
arg2HashId
describe (UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg) =
let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
termHashId Term FPRoundingMode
mode
argHashId :: HashId
argHashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg
in Digest
-> FPRoundingUnaryOp
-> HashId
-> HashId
-> Description (Term (fp eb sb))
forall (bv :: Natural -> Natural -> *) (n :: Natural)
(sb :: Natural).
Digest
-> FPRoundingUnaryOp
-> HashId
-> HashId
-> Description (Term (bv n sb))
DFPRoundingUnaryTerm
(FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription FPRoundingUnaryOp
op HashId
modeHashId HashId
argHashId)
FPRoundingUnaryOp
op
HashId
modeHashId
HashId
argHashId
describe (UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
termHashId Term FPRoundingMode
mode
arg1HashId :: HashId
arg1HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg1
arg2HashId :: HashId
arg2HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg2
in Digest
-> FPRoundingBinaryOp
-> HashId
-> HashId
-> HashId
-> Description (Term (fp eb sb))
forall (bv :: Natural -> Natural -> *) (n :: Natural)
(sb :: Natural).
Digest
-> FPRoundingBinaryOp
-> HashId
-> HashId
-> HashId
-> Description (Term (bv n sb))
DFPRoundingBinaryTerm
( FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription
FPRoundingBinaryOp
op
HashId
modeHashId
HashId
arg1HashId
HashId
arg2HashId
)
FPRoundingBinaryOp
op
HashId
modeHashId
HashId
arg1HashId
HashId
arg2HashId
describe (UFPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3) =
let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
termHashId Term FPRoundingMode
mode
arg1HashId :: HashId
arg1HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg1
arg2HashId :: HashId
arg2HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg2
arg3HashId :: HashId
arg3HashId = Term (fp eb sb) -> HashId
forall t. Term t -> HashId
termHashId Term (fp eb sb)
arg3
in Digest
-> HashId
-> HashId
-> HashId
-> HashId
-> Description (Term (fp eb sb))
forall (bv :: Natural -> Natural -> *) (n :: Natural)
(sb :: Natural).
Digest
-> HashId
-> HashId
-> HashId
-> HashId
-> Description (Term (bv n sb))
DFPFMATerm
(HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription HashId
modeHashId HashId
arg1HashId HashId
arg2HashId HashId
arg3HashId)
HashId
modeHashId
HashId
arg1HashId
HashId
arg2HashId
HashId
arg3HashId
describe (UFromIntegralTerm (Term a
arg :: Term a)) =
let argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term a
arg
in Digest -> TypeHashId -> Description (Term t)
forall b. Digest -> TypeHashId -> Description (Term b)
DFromIntegralTerm (TypeHashId -> Digest
preHashFromIntegralDescription TypeHashId
argHashId) TypeHashId
argHashId
describe (UFromFPOrTerm Term t
d Term FPRoundingMode
mode (Term (FP eb sb)
arg :: Term a)) =
let dHashId :: HashId
dHashId = Term t -> HashId
forall t. Term t -> HashId
termHashId Term t
d
modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
termHashId Term FPRoundingMode
mode
argHashId :: TypeHashId
argHashId = Term (FP eb sb) -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term (FP eb sb)
arg
in Digest -> HashId -> HashId -> TypeHashId -> Description (Term t)
forall a.
Digest -> HashId -> HashId -> TypeHashId -> Description (Term a)
DFromFPOrTerm
(HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription HashId
dHashId HashId
modeHashId TypeHashId
argHashId)
HashId
dHashId
HashId
modeHashId
TypeHashId
argHashId
describe (UToFPTerm Term FPRoundingMode
mode (Term a
arg :: Term a) Proxy eb
_ Proxy sb
_) =
let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
termHashId Term FPRoundingMode
mode
argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
termTypeHashId Term a
arg
in Digest -> HashId -> TypeHashId -> Description (Term (FP eb sb))
forall (bv :: Natural) (n :: Natural).
Digest -> HashId -> TypeHashId -> Description (Term (FP bv n))
DToFPTerm
(HashId -> TypeHashId -> Digest
preHashToFPTermDescription HashId
modeHashId TypeHashId
argHashId)
HashId
modeHashId
TypeHashId
argHashId
identify :: CachedInfo -> Uninterned (Term t) -> Term t
identify CachedInfo
info = Uninterned (Term t) -> Term t
UTerm t -> Term t
go
where
go :: UTerm t -> Term t
go (UConTerm t
v) = CachedInfo -> PhantomDict t -> t -> Term t
forall t. CachedInfo -> PhantomDict t -> t -> Term t
goPhantomCon CachedInfo
info PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict t
v
go (USymTerm TypedSymbol 'AnyKind t
v) = CachedInfo -> TypedSymbol 'AnyKind t -> Term t
forall t. CachedInfo -> TypedSymbol 'AnyKind t -> Term t
SymTerm' CachedInfo
info TypedSymbol 'AnyKind t
v
go (UForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = CachedInfo -> TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall bv.
CachedInfo
-> TypedSymbol 'ConstantKind bv -> Term Bool -> Term Bool
ForallTerm' CachedInfo
info TypedSymbol 'ConstantKind t
sym Term Bool
arg
go (UExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = CachedInfo -> TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall bv.
CachedInfo
-> TypedSymbol 'ConstantKind bv -> Term Bool -> Term Bool
ExistsTerm' CachedInfo
info TypedSymbol 'ConstantKind t
sym Term Bool
arg
go (UNotTerm Term Bool
arg) = CachedInfo -> Term Bool -> Term Bool
NotTerm' CachedInfo
info Term Bool
arg
go (UOrTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) = CachedInfo
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
OrTerm' CachedInfo
info Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s
go (UAndTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) = CachedInfo
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
AndTerm' CachedInfo
info Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s
go (UEqTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term Bool
forall bv. CachedInfo -> Term bv -> Term bv -> Term Bool
EqTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UDistinctTerm NonEmpty (Term t)
args) = CachedInfo -> NonEmpty (Term t) -> Term Bool
forall bv. CachedInfo -> NonEmpty (Term bv) -> Term Bool
DistinctTerm' CachedInfo
info NonEmpty (Term t)
args
go (UITETerm Term Bool
cond Term t
l Term t
r) = CachedInfo -> Term Bool -> Term t -> Term t -> Term t
forall t.
SupportedPrim t =>
CachedInfo -> Term Bool -> Term t -> Term t -> Term t
ITETerm' CachedInfo
info Term Bool
cond Term t
l Term t
r
go (UAddNumTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
AddNumTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UNegNumTerm Term t
arg) = CachedInfo -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
CachedInfo -> Term t -> Term t
NegNumTerm' CachedInfo
info Term t
arg
go (UMulNumTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
MulNumTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UAbsNumTerm Term t
arg) = CachedInfo -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
CachedInfo -> Term t -> Term t
AbsNumTerm' CachedInfo
info Term t
arg
go (USignumNumTerm Term t
arg) = CachedInfo -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
CachedInfo -> Term t -> Term t
SignumNumTerm' CachedInfo
info Term t
arg
go (ULtOrdTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term Bool
forall bv.
(SupportedPrim bv, PEvalOrdTerm bv) =>
CachedInfo -> Term bv -> Term bv -> Term Bool
LtOrdTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (ULeOrdTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term Bool
forall bv.
(SupportedPrim bv, PEvalOrdTerm bv) =>
CachedInfo -> Term bv -> Term bv -> Term Bool
LeOrdTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UAndBitsTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
AndBitsTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UOrBitsTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
OrBitsTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UXorBitsTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
XorBitsTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UComplementBitsTerm Term t
arg) = CachedInfo -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
CachedInfo -> Term t -> Term t
ComplementBitsTerm' CachedInfo
info Term t
arg
go (UShiftLeftTerm Term t
arg Term t
n) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
ShiftLeftTerm' CachedInfo
info Term t
arg Term t
n
go (UShiftRightTerm Term t
arg Term t
n) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
ShiftRightTerm' CachedInfo
info Term t
arg Term t
n
go (URotateLeftTerm Term t
arg Term t
n) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
RotateLeftTerm' CachedInfo
info Term t
arg Term t
n
go (URotateRightTerm Term t
arg Term t
n) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
RotateRightTerm' CachedInfo
info Term t
arg Term t
n
go (UBitCastTerm Term a
arg) = CachedInfo -> PhantomDict t -> Term a -> Term t
forall a t.
PEvalBitCastTerm a t =>
CachedInfo -> PhantomDict t -> Term a -> Term t
goPhantomBitCast CachedInfo
info PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term a
arg
go (UBitCastOrTerm Term t
d Term a
arg) = CachedInfo -> Term t -> Term a -> Term t
forall b bv.
(SupportedPrim b, PEvalBitCastOrTerm bv b) =>
CachedInfo -> Term b -> Term bv -> Term b
BitCastOrTerm' CachedInfo
info Term t
d Term a
arg
go (UBVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2) =
CachedInfo
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r)) =>
CachedInfo
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
goPhantomBVConcat CachedInfo
info PhantomDict (bv (l + r))
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term (bv l)
arg1 Term (bv r)
arg2
go (UBVSelectTerm Proxy ix
ix Proxy w
w Term (bv n)
arg) =
CachedInfo
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
CachedInfo
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
goPhantomBVSelect CachedInfo
info PhantomDict (bv w)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Proxy ix
ix Proxy w
w Term (bv n)
arg
go (UBVExtendTerm Bool
signed Proxy r
n Term (bv l)
arg) =
CachedInfo
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
CachedInfo
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
goPhantomBVExtend CachedInfo
info PhantomDict (bv r)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Bool
signed Proxy r
n Term (bv l)
arg
go (UApplyTerm Term f
f Term a
arg) = CachedInfo -> PhantomDict t -> Term f -> Term a -> Term t
forall f a t.
PEvalApplyTerm f a t =>
CachedInfo -> PhantomDict t -> Term f -> Term a -> Term t
goPhantomApply CachedInfo
info PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term f
f Term a
arg
go (UDivIntegralTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
DivIntegralTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UModIntegralTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
ModIntegralTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UQuotIntegralTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
QuotIntegralTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (URemIntegralTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
RemIntegralTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UFPTraitTerm FPTrait
trait Term (fp eb sb)
arg) =
CachedInfo
-> PhantomDict (fp eb sb)
-> FPTrait
-> Term (fp eb sb)
-> Term Bool
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPTrait
-> Term (fp eb sb)
-> Term Bool
goPhantomFPTrait CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPTrait
trait Term (fp eb sb)
arg
go (UFdivTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
FdivTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (URecipTerm Term t
arg) = CachedInfo -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
CachedInfo -> Term t -> Term t
RecipTerm' CachedInfo
info Term t
arg
go (UFloatingUnaryTerm FloatingUnaryOp
op Term t
arg) = CachedInfo -> FloatingUnaryOp -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
CachedInfo -> FloatingUnaryOp -> Term t -> Term t
FloatingUnaryTerm' CachedInfo
info FloatingUnaryOp
op Term t
arg
go (UPowerTerm Term t
arg1 Term t
arg2) = CachedInfo -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
CachedInfo -> Term t -> Term t -> Term t
PowerTerm' CachedInfo
info Term t
arg1 Term t
arg2
go (UFPUnaryTerm FPUnaryOp
op Term (fp eb sb)
arg) = CachedInfo
-> PhantomDict (fp eb sb)
-> FPUnaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPUnaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPUnary CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPUnaryOp
op Term (fp eb sb)
arg
go (UFPBinaryTerm FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
CachedInfo
-> PhantomDict (fp eb sb)
-> FPBinaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPBinaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPBinary CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
go (UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg) =
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPRoundingUnary CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg
go (UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPRoundingBinary CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
go (UFPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3) =
CachedInfo
-> PhantomDict (fp eb sb)
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPFMA CachedInfo
info PhantomDict (fp eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3
go (UFromIntegralTerm Term a
arg) =
CachedInfo -> PhantomDict t -> Term a -> Term t
forall a b.
PEvalFromIntegralTerm a b =>
CachedInfo -> PhantomDict b -> Term a -> Term b
goPhantomFromIntegral CachedInfo
info PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term a
arg
go (UFromFPOrTerm Term t
d Term FPRoundingMode
mode Term (FP eb sb)
arg) = CachedInfo
-> Term t -> Term FPRoundingMode -> Term (FP eb sb) -> Term t
forall a (bv :: Natural) (n :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP bv n, SupportedPrim a) =>
CachedInfo
-> Term a -> Term FPRoundingMode -> Term (FP bv n) -> Term a
FromFPOrTerm' CachedInfo
info Term t
d Term FPRoundingMode
mode Term (FP eb sb)
arg
go (UToFPTerm Term FPRoundingMode
mode (Term a
arg :: Term a) Proxy eb
_ Proxy sb
_) =
CachedInfo
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
CachedInfo
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
goPhantomToFP CachedInfo
info PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term FPRoundingMode
mode Term a
arg
{-# INLINE go #-}
threadId :: Term t -> WeakThreadId
threadId = Term t -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId
{-# INLINE threadId #-}
descriptionDigest :: Description (Term t) -> Digest
descriptionDigest (DConTerm t -> t -> Bool
_ Digest
h t
_) = Digest
h
descriptionDigest (DSymTerm Digest
h TypedSymbol 'AnyKind t
_) = Digest
h
descriptionDigest (DForallTerm Digest
h TypedSymbol 'ConstantKind t
_ HashId
_) = Digest
h
descriptionDigest (DExistsTerm Digest
h TypedSymbol 'ConstantKind t
_ HashId
_) = Digest
h
descriptionDigest (DNotTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DOrTerm Digest
h HashId
_ HashId
_ HashSet (Term Bool)
_) = Digest
h
descriptionDigest (DAndTerm Digest
h HashId
_ HashId
_ HashSet (Term Bool)
_) = Digest
h
descriptionDigest (DEqTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DDistinctTerm Digest
h Fingerprint
_ NonEmpty HashId
_) = Digest
h
descriptionDigest (DITETerm Digest
h HashId
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DAddNumTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DNegNumTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DMulNumTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DAbsNumTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DSignumNumTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DLtOrdTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DLeOrdTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DAndBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DOrBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DXorBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DComplementBitsTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DShiftLeftTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DShiftRightTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DRotateLeftTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DRotateRightTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DBitCastTerm Digest
h TypeHashId
_) = Digest
h
descriptionDigest (DBitCastOrTerm Digest
h HashId
_ TypeHashId
_) = Digest
h
descriptionDigest (DBVConcatTerm Digest
h TypeHashId
_ TypeHashId
_) = Digest
h
descriptionDigest (DBVSelectTerm Digest
h Fingerprint
_ TypeHashId
_) = Digest
h
descriptionDigest (DBVExtendTerm Digest
h Bool
_ Proxy r
_ TypeHashId
_) = Digest
h
descriptionDigest (DDivIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DModIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DQuotIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DRemIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DApplyTerm Digest
h TypeHashId
_ TypeHashId
_) = Digest
h
descriptionDigest (DFPTraitTerm Digest
h FPTrait
_ TypeHashId
_) = Digest
h
descriptionDigest (DFdivTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DRecipTerm Digest
h HashId
_) = Digest
h
descriptionDigest (DFloatingUnaryTerm Digest
h FloatingUnaryOp
_ HashId
_) = Digest
h
descriptionDigest (DPowerTerm Digest
h HashId
_ HashId
_) = Digest
h
descriptionDigest (DFPUnaryTerm Digest
h FPUnaryOp
_ HashId
_) = Digest
h
descriptionDigest (DFPBinaryTerm Digest
h FPBinaryOp
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DFPRoundingUnaryTerm Digest
h FPRoundingUnaryOp
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DFPRoundingBinaryTerm Digest
h FPRoundingBinaryOp
_ HashId
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DFPFMATerm Digest
h HashId
_ HashId
_ HashId
_ HashId
_) = Digest
h
descriptionDigest (DFromIntegralTerm Digest
h TypeHashId
_) = Digest
h
descriptionDigest (DFromFPOrTerm Digest
h HashId
_ HashId
_ TypeHashId
_) = Digest
h
descriptionDigest (DToFPTerm Digest
h HashId
_ TypeHashId
_) = Digest
h
{-# NOINLINE goPhantomCon #-}
goPhantomCon ::
CachedInfo ->
PhantomDict t ->
t ->
Term t
goPhantomCon :: forall t. CachedInfo -> PhantomDict t -> t -> Term t
goPhantomCon CachedInfo
info PhantomDict t
PhantomDict t
v = CachedInfo -> t -> Term t
forall t. SupportedPrim t => CachedInfo -> t -> Term t
ConTerm' CachedInfo
info t
v
{-# NOINLINE goPhantomBitCast #-}
goPhantomBitCast ::
(PEvalBitCastTerm a t) =>
CachedInfo ->
PhantomDict t ->
Term a ->
Term t
goPhantomBitCast :: forall a t.
PEvalBitCastTerm a t =>
CachedInfo -> PhantomDict t -> Term a -> Term t
goPhantomBitCast CachedInfo
info PhantomDict t
PhantomDict Term a
arg = CachedInfo -> Term a -> Term t
forall b bv.
(SupportedPrim b, PEvalBitCastTerm bv b) =>
CachedInfo -> Term bv -> Term b
BitCastTerm' CachedInfo
info Term a
arg
{-# NOINLINE goPhantomBVConcat #-}
goPhantomBVConcat ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r
) =>
CachedInfo ->
PhantomDict (bv (l + r)) ->
Term (bv l) ->
Term (bv r) ->
Term (bv (l + r))
goPhantomBVConcat :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r)) =>
CachedInfo
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
goPhantomBVConcat CachedInfo
info PhantomDict (bv (l + r))
PhantomDict Term (bv l)
arg1 Term (bv r)
arg2 =
CachedInfo -> Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, KnownNat (n + sb),
1 <= n, 1 <= sb, 1 <= (n + sb), SupportedPrim (bv (n + sb))) =>
CachedInfo -> Term (bv n) -> Term (bv sb) -> Term (bv (n + sb))
BVConcatTerm' CachedInfo
info Term (bv l)
arg1 Term (bv r)
arg2
{-# NOINLINE goPhantomBVSelect #-}
goPhantomBVSelect ::
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n
) =>
CachedInfo ->
PhantomDict (bv w) ->
Proxy ix ->
Proxy w ->
Term (bv n) ->
Term (bv w)
goPhantomBVSelect :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
CachedInfo
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
goPhantomBVSelect CachedInfo
info PhantomDict (bv w)
PhantomDict Proxy ix
ix Proxy w
w Term (bv n)
arg =
CachedInfo -> Proxy ix -> Proxy w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural)
(w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, KnownNat w, 1 <= n,
1 <= w, (sb + w) <= n, SupportedPrim (bv w)) =>
CachedInfo -> Proxy sb -> Proxy w -> Term (bv n) -> Term (bv w)
BVSelectTerm' CachedInfo
info Proxy ix
ix Proxy w
w Term (bv n)
arg
{-# NOINLINE goPhantomBVExtend #-}
goPhantomBVExtend ::
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r
) =>
CachedInfo ->
PhantomDict (bv r) ->
Bool ->
Proxy r ->
Term (bv l) ->
Term (bv r)
goPhantomBVExtend :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
CachedInfo
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
goPhantomBVExtend CachedInfo
info PhantomDict (bv r)
PhantomDict Bool
signed Proxy r
n Term (bv l)
arg =
CachedInfo -> Bool -> Proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, 1 <= n, 1 <= sb, n <= sb,
SupportedPrim (bv sb)) =>
CachedInfo -> Bool -> Proxy sb -> Term (bv n) -> Term (bv sb)
BVExtendTerm' CachedInfo
info Bool
signed Proxy r
n Term (bv l)
arg
{-# NOINLINE goPhantomApply #-}
goPhantomApply ::
(PEvalApplyTerm f a t) =>
CachedInfo ->
PhantomDict t ->
Term f ->
Term a ->
Term t
goPhantomApply :: forall f a t.
PEvalApplyTerm f a t =>
CachedInfo -> PhantomDict t -> Term f -> Term a -> Term t
goPhantomApply CachedInfo
info PhantomDict t
PhantomDict Term f
f Term a
arg = CachedInfo -> Term f -> Term a -> Term t
forall bv n b.
(PEvalApplyTerm bv n b, SupportedPrim b) =>
CachedInfo -> Term bv -> Term n -> Term b
ApplyTerm' CachedInfo
info Term f
f Term a
arg
{-# NOINLINE goPhantomFPTrait #-}
goPhantomFPTrait ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
FPTrait ->
Term (fp eb sb) ->
Term Bool
goPhantomFPTrait :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPTrait
-> Term (fp eb sb)
-> Term Bool
goPhantomFPTrait CachedInfo
info PhantomDict (fp eb sb)
PhantomDict FPTrait
trait Term (fp eb sb)
arg = CachedInfo -> FPTrait -> Term (fp eb sb) -> Term Bool
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo -> FPTrait -> Term (sb bv n) -> Term Bool
FPTraitTerm' CachedInfo
info FPTrait
trait Term (fp eb sb)
arg
{-# NOINLINE goPhantomFPUnary #-}
goPhantomFPUnary ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
FPUnaryOp ->
Term (fp eb sb) ->
Term (fp eb sb)
goPhantomFPUnary :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPUnaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPUnary CachedInfo
info PhantomDict (fp eb sb)
PhantomDict FPUnaryOp
op Term (fp eb sb)
arg = CachedInfo -> FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo -> FPUnaryOp -> Term (sb bv n) -> Term (sb bv n)
FPUnaryTerm' CachedInfo
info FPUnaryOp
op Term (fp eb sb)
arg
{-# NOINLINE goPhantomFPBinary #-}
goPhantomFPBinary ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
FPBinaryOp ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
goPhantomFPBinary :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPBinaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPBinary CachedInfo
info PhantomDict (fp eb sb)
PhantomDict FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 =
CachedInfo
-> FPBinaryOp
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo
-> FPBinaryOp -> Term (sb bv n) -> Term (sb bv n) -> Term (sb bv n)
FPBinaryTerm' CachedInfo
info FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
{-# NOINLINE goPhantomFPRoundingUnary #-}
goPhantomFPRoundingUnary ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
FPRoundingUnaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb)
goPhantomFPRoundingUnary :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPRoundingUnary CachedInfo
info PhantomDict (fp eb sb)
PhantomDict FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg =
CachedInfo
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (sb bv n)
-> Term (sb bv n)
FPRoundingUnaryTerm' CachedInfo
info FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg
{-# NOINLINE goPhantomFPRoundingBinary #-}
goPhantomFPRoundingBinary ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
FPRoundingBinaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
goPhantomFPRoundingBinary :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPRoundingBinary CachedInfo
info PhantomDict (fp eb sb)
PhantomDict FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 =
CachedInfo
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (sb bv n)
-> Term (sb bv n)
-> Term (sb bv n)
FPRoundingBinaryTerm' CachedInfo
info FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
{-# NOINLINE goPhantomFPFMA #-}
goPhantomFPFMA ::
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo ->
PhantomDict (fp eb sb) ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
goPhantomFPFMA :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, PEvalFPTerm fp) =>
CachedInfo
-> PhantomDict (fp eb sb)
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
goPhantomFPFMA CachedInfo
info PhantomDict (fp eb sb)
PhantomDict Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3 =
CachedInfo
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
CachedInfo
-> Term FPRoundingMode
-> Term (sb bv n)
-> Term (sb bv n)
-> Term (sb bv n)
-> Term (sb bv n)
FPFMATerm' CachedInfo
info Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3
{-# NOINLINE goPhantomFromIntegral #-}
goPhantomFromIntegral ::
(PEvalFromIntegralTerm a b) =>
CachedInfo ->
PhantomDict b ->
Term a ->
Term b
goPhantomFromIntegral :: forall a b.
PEvalFromIntegralTerm a b =>
CachedInfo -> PhantomDict b -> Term a -> Term b
goPhantomFromIntegral CachedInfo
info PhantomDict b
PhantomDict Term a
arg = CachedInfo -> Term a -> Term b
forall bv b.
(PEvalFromIntegralTerm bv b, SupportedPrim b) =>
CachedInfo -> Term bv -> Term b
FromIntegralTerm' CachedInfo
info Term a
arg
{-# NOINLINE goPhantomToFP #-}
goPhantomToFP ::
forall a eb sb.
(ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
CachedInfo ->
PhantomDict (FP eb sb) ->
Term FPRoundingMode ->
Term a ->
Term (FP eb sb)
goPhantomToFP :: forall a (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
CachedInfo
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
goPhantomToFP CachedInfo
info PhantomDict (FP eb sb)
PhantomDict Term FPRoundingMode
mode Term a
arg =
CachedInfo
-> Term FPRoundingMode
-> Term a
-> Proxy eb
-> Proxy sb
-> Term (FP eb sb)
forall bv (n :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm bv, ValidFP n sb,
SupportedPrim (FP n sb)) =>
CachedInfo
-> Term FPRoundingMode
-> Term bv
-> Proxy n
-> Proxy sb
-> Term (FP n sb)
ToFPTerm' CachedInfo
info Term FPRoundingMode
mode Term a
arg (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @eb) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @sb)
instance Eq (Description (Term t)) where
DConTerm t -> t -> Bool
eqFunc Digest
_ t
l == :: Description (Term t) -> Description (Term t) -> Bool
== DConTerm t -> t -> Bool
_ Digest
_ t
r =
t -> t -> Bool
eqFunc t
l t
r
DSymTerm Digest
_ TypedSymbol 'AnyKind t
ls == DSymTerm Digest
_ TypedSymbol 'AnyKind t
rs = TypedSymbol 'AnyKind t
ls TypedSymbol 'AnyKind t -> TypedSymbol 'AnyKind t -> Bool
forall a. Eq a => a -> a -> Bool
== TypedSymbol 'AnyKind t
rs
DForallTerm Digest
_ TypedSymbol 'ConstantKind t
ls HashId
li == DForallTerm Digest
_ TypedSymbol 'ConstantKind t
rs HashId
ri =
TypedSymbol 'ConstantKind t -> TypedSymbol 'ConstantKind t -> Bool
forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol TypedSymbol 'ConstantKind t
ls TypedSymbol 'ConstantKind t
rs Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DExistsTerm Digest
_ TypedSymbol 'ConstantKind t
ls HashId
li == DExistsTerm Digest
_ TypedSymbol 'ConstantKind t
rs HashId
ri =
TypedSymbol 'ConstantKind t -> TypedSymbol 'ConstantKind t -> Bool
forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol TypedSymbol 'ConstantKind t
ls TypedSymbol 'ConstantKind t
rs Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DNotTerm Digest
_ HashId
li == DNotTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DOrTerm Digest
_ HashId
li1 HashId
li2 HashSet (Term Bool)
_ == DOrTerm Digest
_ HashId
ri1 HashId
ri2 HashSet (Term Bool)
_ = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DAndTerm Digest
_ HashId
li1 HashId
li2 HashSet (Term Bool)
_ == DAndTerm Digest
_ HashId
ri1 HashId
ri2 HashSet (Term Bool)
_ = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DEqTerm Digest
_ Fingerprint
lfp HashId
li1 HashId
li2 == DEqTerm Digest
_ Fingerprint
rfp HashId
ri1 HashId
ri2 = Fingerprint
lfp Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rfp Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DDistinctTerm Digest
_ Fingerprint
lfp NonEmpty HashId
li == DDistinctTerm Digest
_ Fingerprint
rfp NonEmpty HashId
ri =
Fingerprint
lfp Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rfp
Bool -> Bool -> Bool
&& NonEmpty HashId -> Int
forall a. NonEmpty a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length NonEmpty HashId
li Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== NonEmpty HashId -> Int
forall a. NonEmpty a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length NonEmpty HashId
ri
Bool -> Bool -> Bool
&& [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ((HashId -> HashId -> Bool) -> [HashId] -> [HashId] -> [Bool]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith HashId -> HashId -> Bool
eqHashId (NonEmpty HashId -> [HashId]
forall a. NonEmpty a -> [a]
toList NonEmpty HashId
li) (NonEmpty HashId -> [HashId]
forall a. NonEmpty a -> [a]
toList NonEmpty HashId
ri))
DITETerm Digest
_ HashId
lc HashId
li1 HashId
li2 == DITETerm Digest
_ HashId
rc HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
lc HashId
rc Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DAddNumTerm Digest
_ HashId
li1 HashId
li2 == DAddNumTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DNegNumTerm Digest
_ HashId
li == DNegNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DMulNumTerm Digest
_ HashId
li1 HashId
li2 == DMulNumTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DAbsNumTerm Digest
_ HashId
li == DAbsNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DSignumNumTerm Digest
_ HashId
li == DSignumNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DLtOrdTerm Digest
_ Fingerprint
lrep HashId
li1 HashId
li2 == DLtOrdTerm Digest
_ Fingerprint
rrep HashId
ri1 HashId
ri2 = Fingerprint
lrep Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rrep Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DLeOrdTerm Digest
_ Fingerprint
lrep HashId
li1 HashId
li2 == DLeOrdTerm Digest
_ Fingerprint
rrep HashId
ri1 HashId
ri2 = Fingerprint
lrep Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rrep Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DAndBitsTerm Digest
_ HashId
li1 HashId
li2 == DAndBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DOrBitsTerm Digest
_ HashId
li1 HashId
li2 == DOrBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DXorBitsTerm Digest
_ HashId
li1 HashId
li2 == DXorBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DComplementBitsTerm Digest
_ HashId
li == DComplementBitsTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DShiftLeftTerm Digest
_ HashId
li HashId
ln == DShiftLeftTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
DShiftRightTerm Digest
_ HashId
li HashId
ln == DShiftRightTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
DRotateLeftTerm Digest
_ HashId
li HashId
ln == DRotateLeftTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
DRotateRightTerm Digest
_ HashId
li HashId
ln == DRotateRightTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
DBitCastTerm Digest
_ TypeHashId
li == DBitCastTerm Digest
_ TypeHashId
ri = TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DBitCastOrTerm Digest
_ HashId
ld TypeHashId
li == DBitCastOrTerm Digest
_ HashId
rd TypeHashId
ri = HashId
ld HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
== HashId
rd Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DBVConcatTerm Digest
_ TypeHashId
li1 TypeHashId
li2 == DBVConcatTerm Digest
_ TypeHashId
ri1 TypeHashId
ri2 = TypeHashId
li1 TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri1 Bool -> Bool -> Bool
&& TypeHashId
li2 TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri2
DBVSelectTerm Digest
_ Fingerprint
lix TypeHashId
li == DBVSelectTerm Digest
_ Fingerprint
rix TypeHashId
ri =
Fingerprint
lix Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rix Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DBVExtendTerm Digest
_ Bool
lIsSigned Proxy r
_ TypeHashId
li == DBVExtendTerm Digest
_ Bool
rIsSigned Proxy r
_ TypeHashId
ri =
Bool
lIsSigned Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
rIsSigned
Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DApplyTerm Digest
_ TypeHashId
lf TypeHashId
li == DApplyTerm Digest
_ TypeHashId
rf TypeHashId
ri = TypeHashId
lf TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rf Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DDivIntegralTerm Digest
_ HashId
li1 HashId
li2 == DDivIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DModIntegralTerm Digest
_ HashId
li1 HashId
li2 == DModIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DQuotIntegralTerm Digest
_ HashId
li1 HashId
li2 == DQuotIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DRemIntegralTerm Digest
_ HashId
li1 HashId
li2 == DRemIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DFPTraitTerm Digest
_ FPTrait
lt TypeHashId
li == DFPTraitTerm Digest
_ FPTrait
rt TypeHashId
ri = FPTrait
lt FPTrait -> FPTrait -> Bool
forall a. Eq a => a -> a -> Bool
== FPTrait
rt Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DFdivTerm Digest
_ HashId
li1 HashId
li2 == DFdivTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DRecipTerm Digest
_ HashId
li == DRecipTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DFloatingUnaryTerm Digest
_ FloatingUnaryOp
lop HashId
li == DFloatingUnaryTerm Digest
_ FloatingUnaryOp
rop HashId
ri = FloatingUnaryOp
lop FloatingUnaryOp -> FloatingUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FloatingUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DPowerTerm Digest
_ HashId
li1 HashId
li2 == DPowerTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DFPUnaryTerm Digest
_ FPUnaryOp
lop HashId
li == DFPUnaryTerm Digest
_ FPUnaryOp
rop HashId
ri = FPUnaryOp
lop FPUnaryOp -> FPUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DFPBinaryTerm Digest
_ FPBinaryOp
lop HashId
li1 HashId
li2 == DFPBinaryTerm Digest
_ FPBinaryOp
rop HashId
ri1 HashId
ri2 = FPBinaryOp
lop FPBinaryOp -> FPBinaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPBinaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DFPRoundingUnaryTerm Digest
_ FPRoundingUnaryOp
lop HashId
lmode HashId
li == DFPRoundingUnaryTerm Digest
_ FPRoundingUnaryOp
rop HashId
rmode HashId
ri =
FPRoundingUnaryOp
lop FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPRoundingUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
DFPRoundingBinaryTerm Digest
_ FPRoundingBinaryOp
lop HashId
lmode HashId
li1 HashId
li2 == DFPRoundingBinaryTerm Digest
_ FPRoundingBinaryOp
rop HashId
rmode HashId
ri1 HashId
ri2 =
FPRoundingBinaryOp
lop FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPRoundingBinaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
DFPFMATerm Digest
_ HashId
lmode HashId
li1 HashId
li2 HashId
li3 == DFPFMATerm Digest
_ HashId
rmode HashId
ri1 HashId
ri2 HashId
ri3 =
HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li3 HashId
ri3
DFromIntegralTerm Digest
_ TypeHashId
li == DFromIntegralTerm Digest
_ TypeHashId
ri = TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
DFromFPOrTerm Digest
_ HashId
ld HashId
li TypeHashId
lai == DFromFPOrTerm Digest
_ HashId
rd HashId
ri TypeHashId
rai = HashId -> HashId -> Bool
eqHashId HashId
ld HashId
rd Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& TypeHashId
lai TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rai
DToFPTerm Digest
_ HashId
li TypeHashId
lai == DToFPTerm Digest
_ HashId
ri TypeHashId
rai = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& TypeHashId
lai TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rai
Description (Term t)
_ == Description (Term t)
_ = Bool
False
instance Hashable (Description (Term t)) where
hashWithSalt :: Int -> Description (Term t) -> Int
hashWithSalt Int
s = Int -> Digest -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (Digest -> Int)
-> (Description (Term t) -> Digest) -> Description (Term t) -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Description (Term t) -> Digest
forall t. Interned t => Description t -> Digest
descriptionDigest
{-# INLINE hashWithSalt #-}
fullReconstructTerm1 ::
forall a b.
(Term a -> IO (Term b)) ->
Term a ->
IO (Term b)
fullReconstructTerm1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term b)
f Term a
x = Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x IO (Term a) -> (Term a -> IO (Term b)) -> IO (Term b)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Term a -> IO (Term b)
f
{-# INLINE fullReconstructTerm1 #-}
fullReconstructTerm2 ::
forall a b c.
(Term a -> Term b -> IO (Term c)) ->
Term a ->
Term b ->
IO (Term c)
fullReconstructTerm2 :: forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term a -> Term b -> IO (Term c)
f Term a
x Term b
y = do
rx <- Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x
ry <- fullReconstructTerm y
f rx ry
{-# INLINE fullReconstructTerm2 #-}
fullReconstructTerm3 ::
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d)) ->
Term a ->
Term b ->
Term c ->
IO (Term d)
fullReconstructTerm3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
x Term b
y Term c
z = do
rx <- Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x
ry <- fullReconstructTerm y
rz <- fullReconstructTerm z
f rx ry rz
{-# INLINE fullReconstructTerm3 #-}
fullReconstructTerm2Set ::
forall a c.
(Term a -> Term a -> HS.HashSet (Term a) -> IO (Term c)) ->
Term a ->
Term a ->
HS.HashSet (Term a) ->
IO (Term c)
fullReconstructTerm2Set :: forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
fullReconstructTerm2Set Term a -> Term a -> HashSet (Term a) -> IO (Term c)
f Term a
x Term a
y HashSet (Term a)
s = do
rx@SupportedTerm <- Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x
ry <- fullReconstructTerm y
rs <- traverse fullReconstructTerm (HS.toList s)
f rx ry (HS.fromList rs)
{-# INLINE fullReconstructTerm2Set #-}
fullReconstructTerm :: forall t. Term t -> IO (Term t)
fullReconstructTerm :: forall t. Term t -> IO (Term t)
fullReconstructTerm (ConTerm t
i) = t -> IO (Term t)
forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm t
i
fullReconstructTerm (SymTerm TypedSymbol 'AnyKind t
sym) = TypedSymbol 'AnyKind t -> IO (Term t)
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm TypedSymbol 'AnyKind t
sym
fullReconstructTerm (ForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
(Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym) Term Bool
arg
fullReconstructTerm (ExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
(Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym) Term Bool
arg
fullReconstructTerm (NotTerm Term Bool
arg) =
(Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term Bool -> IO (Term t)
Term Bool -> IO (Term Bool)
curThreadNotTerm Term Bool
arg
fullReconstructTerm (OrTermAll Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t)
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
fullReconstructTerm2Set Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t)
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s
fullReconstructTerm (OrTerm Term Bool
_ Term Bool
_) = String -> IO (Term t)
forall a. HasCallStack => String -> a
error String
"Make compiler happy"
fullReconstructTerm (AndTermAll Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t)
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
fullReconstructTerm2Set Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term t)
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm Term Bool
arg1 Term Bool
arg2 HashSet (Term Bool)
s
fullReconstructTerm (AndTerm Term Bool
_ Term Bool
_) = String -> IO (Term t)
forall a. HasCallStack => String -> a
error String
"Make compiler happy"
fullReconstructTerm (EqTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm Term t
arg1 Term t
arg2
fullReconstructTerm (DistinctTerm NonEmpty (Term t)
args) =
(Term t -> IO (Term t))
-> NonEmpty (Term t) -> IO (NonEmpty (Term t))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NonEmpty a -> f (NonEmpty b)
traverse Term t -> IO (Term t)
forall t. Term t -> IO (Term t)
fullReconstructTerm NonEmpty (Term t)
args IO (NonEmpty (Term t))
-> (NonEmpty (Term t) -> IO (Term t)) -> IO (Term t)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= NonEmpty (Term t) -> IO (Term t)
NonEmpty (Term t) -> IO (Term Bool)
forall a. NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm
fullReconstructTerm (ITETerm Term Bool
cond Term t
arg1 Term t
arg2) =
(Term Bool -> Term t -> Term t -> IO (Term t))
-> Term Bool -> Term t -> Term t -> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term Bool -> Term t -> Term t -> IO (Term t)
forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm Term Bool
cond Term t
arg1 Term t
arg2
fullReconstructTerm (AddNumTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm Term t
arg1 Term t
arg2
fullReconstructTerm (NegNumTerm Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm Term t
arg
fullReconstructTerm (MulNumTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm Term t
arg1 Term t
arg2
fullReconstructTerm (AbsNumTerm Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm Term t
arg
fullReconstructTerm (SignumNumTerm Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm Term t
arg
fullReconstructTerm (LtOrdTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm Term t
arg1 Term t
arg2
fullReconstructTerm (LeOrdTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm Term t
arg1 Term t
arg2
fullReconstructTerm (AndBitsTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (OrBitsTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (XorBitsTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (ComplementBitsTerm Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm Term t
arg
fullReconstructTerm (ShiftLeftTerm Term t
arg Term t
n) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm Term t
arg) Term t
n
fullReconstructTerm (ShiftRightTerm Term t
arg Term t
n) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm Term t
arg) Term t
n
fullReconstructTerm (RotateLeftTerm Term t
arg Term t
n) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm Term t
arg) Term t
n
fullReconstructTerm (RotateRightTerm Term t
arg Term t
n) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm Term t
arg) Term t
n
fullReconstructTerm (BitCastTerm Term a
v) =
(Term a -> IO (Term t)) -> Term a -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term t)
forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm Term a
v
fullReconstructTerm (BitCastOrTerm Term t
d Term a
v) =
(Term t -> Term a -> IO (Term t))
-> Term t -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term a -> IO (Term t)
forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm Term t
d Term a
v
fullReconstructTerm (BVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2) =
(Term (bv l) -> Term (bv r) -> IO (Term t))
-> Term (bv l) -> Term (bv r) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term (bv l) -> Term (bv r) -> IO (Term t)
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2
fullReconstructTerm (BVSelectTerm (Proxy ix
_ :: Proxy ix) (Proxy w
_ :: Proxy w) Term (bv n)
arg) =
(Term (bv n) -> IO (Term t)) -> Term (bv n) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Proxy ix -> Proxy w -> Term (bv n) -> IO (Term (bv w))
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w)) Term (bv n)
arg
fullReconstructTerm (BVExtendTerm Bool
signed Proxy r
p Term (bv l)
arg) =
(Term (bv l) -> IO (Term t)) -> Term (bv l) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Bool -> Proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed Proxy r
p) Term (bv l)
arg
fullReconstructTerm (ApplyTerm Term f
f Term a
arg) =
(Term f -> Term a -> IO (Term t))
-> Term f -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term f -> Term a -> IO (Term t)
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm Term f
f Term a
arg
fullReconstructTerm (DivIntegralTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (ModIntegralTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (QuotIntegralTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (RemIntegralTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (FPTraitTerm FPTrait
trait Term (fp eb sb)
arg) =
(Term (fp eb sb) -> IO (Term t)) -> Term (fp eb sb) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FPTrait -> Term (fp eb sb) -> IO (Term Bool)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait) Term (fp eb sb)
arg
fullReconstructTerm (FdivTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm Term t
arg1 Term t
arg2
fullReconstructTerm (RecipTerm Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm Term t
arg
fullReconstructTerm (FloatingUnaryTerm FloatingUnaryOp
op Term t
arg) =
(Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FloatingUnaryOp -> Term t -> IO (Term t)
forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op) Term t
arg
fullReconstructTerm (PowerTerm Term t
arg1 Term t
arg2) =
(Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm Term t
arg1 Term t
arg2
fullReconstructTerm (FPUnaryTerm FPUnaryOp
op Term (fp eb sb)
arg) =
(Term (fp eb sb) -> IO (Term t)) -> Term (fp eb sb) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FPUnaryOp -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpUnaryTerm FPUnaryOp
op) Term (fp eb sb)
arg
fullReconstructTerm (FPBinaryTerm FPBinaryOp
op Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
(Term (fp eb sb) -> Term (fp eb sb) -> IO (Term t))
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 (FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpBinaryTerm FPBinaryOp
op) Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
fullReconstructTerm (FPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg) =
(Term FPRoundingMode -> Term (fp eb sb) -> IO (Term t))
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 (FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op) Term FPRoundingMode
mode Term (fp eb sb)
arg
fullReconstructTerm (FPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2) =
(Term FPRoundingMode
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term t))
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 (FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op) Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2
fullReconstructTerm (FPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
arg1 Term (fp eb sb)
arg2 Term (fp eb sb)
arg3) = do
rmode <- Term FPRoundingMode -> IO (Term FPRoundingMode)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term FPRoundingMode
mode
rarg1 <- fullReconstructTerm arg1
rarg2 <- fullReconstructTerm arg2
rarg3 <- fullReconstructTerm arg3
curThreadFpFMATerm rmode rarg1 rarg2 rarg3
fullReconstructTerm (FromIntegralTerm Term a
arg) =
(Term a -> IO (Term t)) -> Term a -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term t)
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm Term a
arg
fullReconstructTerm (FromFPOrTerm Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg) =
(Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t))
-> Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg
fullReconstructTerm (ToFPTerm Term FPRoundingMode
r Term a
arg Proxy eb
_ Proxy sb
_) =
(Term FPRoundingMode -> Term a -> IO (Term t))
-> Term FPRoundingMode -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term FPRoundingMode -> Term a -> IO (Term t)
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm Term FPRoundingMode
r Term a
arg
toCurThreadImpl :: forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl :: forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term t
t | Term t -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term t
t WeakThreadId -> WeakThreadId -> Bool
forall a. Eq a => a -> a -> Bool
== WeakThreadId
tid = Term t -> IO (Term t)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Term t
t
toCurThreadImpl WeakThreadId
_ Term t
t = Term t -> IO (Term t)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term t
t
{-# INLINE toCurThreadImpl #-}
toCurThread :: forall t. Term t -> IO (Term t)
toCurThread :: forall t. Term t -> IO (Term t)
toCurThread Term t
t = do
tid <- IO WeakThreadId
myWeakThreadId
toCurThreadImpl tid t
{-# INLINE toCurThread #-}
curThreadConTerm :: forall t. (SupportedPrim t) => t -> IO (Term t)
curThreadConTerm :: forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm t
t = Uninterned (Term t) -> IO (Term t)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term t) -> IO (Term t))
-> Uninterned (Term t) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ t -> UTerm t
forall t. SupportedPrim t => t -> UTerm t
UConTerm t
t
{-# INLINE curThreadConTerm #-}
curThreadSymTerm :: forall knd t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm (TypedSymbol Symbol
s) = Uninterned (Term t) -> IO (Term t)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term t) -> IO (Term t))
-> Uninterned (Term t) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'AnyKind t -> UTerm t
forall t. TypedSymbol 'AnyKind t -> UTerm t
USymTerm (TypedSymbol 'AnyKind t -> UTerm t)
-> TypedSymbol 'AnyKind t -> UTerm t
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
{-# INLINE curThreadSymTerm #-}
curThreadForallTerm ::
TypedSymbol 'ConstantKind t ->
Term Bool ->
IO (Term Bool)
curThreadForallTerm :: forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'ConstantKind t -> Term Bool -> UTerm Bool
forall bv. TypedSymbol 'ConstantKind bv -> Term Bool -> UTerm Bool
UForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg
{-# INLINE curThreadForallTerm #-}
curThreadExistsTerm ::
TypedSymbol 'ConstantKind t ->
Term Bool ->
IO (Term Bool)
curThreadExistsTerm :: forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'ConstantKind t -> Term Bool -> UTerm Bool
forall bv. TypedSymbol 'ConstantKind bv -> Term Bool -> UTerm Bool
UExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg
{-# INLINE curThreadExistsTerm #-}
curThreadSsymTerm :: (SupportedPrim t) => Identifier -> IO (Term t)
curThreadSsymTerm :: forall t. SupportedPrim t => Identifier -> IO (Term t)
curThreadSsymTerm Identifier
ident =
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm @AnyKind (TypedSymbol 'AnyKind t -> IO (Term t))
-> TypedSymbol 'AnyKind t -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol 'AnyKind t)
-> Symbol -> TypedSymbol 'AnyKind t
forall a b. (a -> b) -> a -> b
$ Identifier -> Symbol
SimpleSymbol Identifier
ident
{-# INLINE curThreadSsymTerm #-}
curThreadIsymTerm :: (SupportedPrim t) => Identifier -> Int -> IO (Term t)
curThreadIsymTerm :: forall t. SupportedPrim t => Identifier -> Int -> IO (Term t)
curThreadIsymTerm Identifier
str Int
idx =
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm @AnyKind (TypedSymbol 'AnyKind t -> IO (Term t))
-> TypedSymbol 'AnyKind t -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol 'AnyKind t)
-> Symbol -> TypedSymbol 'AnyKind t
forall a b. (a -> b) -> a -> b
$ Identifier -> Int -> Symbol
IndexedSymbol Identifier
str Int
idx
{-# INLINE curThreadIsymTerm #-}
curThreadNotTerm :: Term Bool -> IO (Term Bool)
curThreadNotTerm :: Term Bool -> IO (Term Bool)
curThreadNotTerm = Uninterned (Term Bool) -> IO (Term Bool)
UTerm Bool -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm Bool -> IO (Term Bool))
-> (Term Bool -> UTerm Bool) -> Term Bool -> IO (Term Bool)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term Bool -> UTerm Bool
UNotTerm
{-# INLINE curThreadNotTerm #-}
curThreadOrTerm :: Term Bool -> Term Bool -> HS.HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm :: Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm Term Bool
l Term Bool
r HashSet (Term Bool)
s = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> HashSet (Term Bool) -> UTerm Bool
UOrTerm Term Bool
l Term Bool
r HashSet (Term Bool)
s
{-# INLINE curThreadOrTerm #-}
curThreadAndTerm :: Term Bool -> Term Bool -> HS.HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm :: Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm Term Bool
l Term Bool
r HashSet (Term Bool)
s = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> HashSet (Term Bool) -> UTerm Bool
UAndTerm Term Bool
l Term Bool
r HashSet (Term Bool)
s
{-# INLINE curThreadAndTerm #-}
curThreadEqTerm :: Term a -> Term a -> IO (Term Bool)
curThreadEqTerm :: forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm Term a
l Term a
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall bv. Term bv -> Term bv -> UTerm Bool
UEqTerm Term a
l Term a
r
{-# INLINE curThreadEqTerm #-}
curThreadDistinctTerm :: NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm :: forall a. NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm NonEmpty (Term a)
args = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ NonEmpty (Term a) -> UTerm Bool
forall bv. NonEmpty (Term bv) -> UTerm Bool
UDistinctTerm NonEmpty (Term a)
args
{-# INLINE curThreadDistinctTerm #-}
curThreadIteTerm :: Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm :: forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm Term Bool
c l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> UTerm a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> UTerm t
UITETerm Term Bool
c Term a
l Term a
r
{-# INLINE curThreadIteTerm #-}
curThreadAddNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> UTerm t
UAddNumTerm Term a
l Term a
r
{-# INLINE curThreadAddNumTerm #-}
curThreadNegNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadNegNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm l :: Term a
l@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
UNegNumTerm Term a
l
{-# INLINE curThreadNegNumTerm #-}
curThreadMulNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> UTerm t
UMulNumTerm Term a
l Term a
r
{-# INLINE curThreadMulNumTerm #-}
curThreadAbsNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadAbsNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm l :: Term a
l@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
UAbsNumTerm Term a
l
{-# INLINE curThreadAbsNumTerm #-}
curThreadSignumNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadSignumNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm l :: Term a
l@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
USignumNumTerm Term a
l
{-# INLINE curThreadSignumNumTerm #-}
curThreadLtOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall bv.
(SupportedPrim bv, PEvalOrdTerm bv) =>
Term bv -> Term bv -> UTerm Bool
ULtOrdTerm Term a
l Term a
r
{-# INLINE curThreadLtOrdTerm #-}
curThreadLeOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall bv.
(SupportedPrim bv, PEvalOrdTerm bv) =>
Term bv -> Term bv -> UTerm Bool
ULeOrdTerm Term a
l Term a
r
{-# INLINE curThreadLeOrdTerm #-}
curThreadAndBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UAndBitsTerm Term a
l Term a
r
{-# INLINE curThreadAndBitsTerm #-}
curThreadOrBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UOrBitsTerm Term a
l Term a
r
{-# INLINE curThreadOrBitsTerm #-}
curThreadXorBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UXorBitsTerm Term a
l Term a
r
{-# INLINE curThreadXorBitsTerm #-}
curThreadComplementBitsTerm :: (PEvalBitwiseTerm a) => Term a -> IO (Term a)
curThreadComplementBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm l :: Term a
l@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> UTerm t
UComplementBitsTerm Term a
l
{-# INLINE curThreadComplementBitsTerm #-}
curThreadShiftLeftTerm :: (PEvalShiftTerm a) => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm t :: Term a
t@Term a
SupportedTerm Term a
n = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> UTerm t
UShiftLeftTerm Term a
t Term a
n
{-# INLINE curThreadShiftLeftTerm #-}
curThreadShiftRightTerm :: (PEvalShiftTerm a) => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm t :: Term a
t@Term a
SupportedTerm Term a
n = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> UTerm t
UShiftRightTerm Term a
t Term a
n
{-# INLINE curThreadShiftRightTerm #-}
curThreadRotateLeftTerm ::
(PEvalRotateTerm a) => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm t :: Term a
t@Term a
SupportedTerm Term a
n = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> UTerm t
URotateLeftTerm Term a
t Term a
n
{-# INLINE curThreadRotateLeftTerm #-}
curThreadRotateRightTerm ::
(PEvalRotateTerm a) => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm t :: Term a
t@Term a
SupportedTerm Term a
n = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> UTerm t
URotateRightTerm Term a
t Term a
n
{-# INLINE curThreadRotateRightTerm #-}
curThreadBitCastTerm ::
forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a ->
IO (Term b)
curThreadBitCastTerm :: forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm = Uninterned (Term b) -> IO (Term b)
UTerm b -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm b -> IO (Term b))
-> (Term a -> UTerm b) -> Term a -> IO (Term b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term a -> UTerm b
forall b bv.
(SupportedPrim b, PEvalBitCastTerm bv b) =>
Term bv -> UTerm b
UBitCastTerm
{-# INLINE curThreadBitCastTerm #-}
curThreadBitCastOrTerm ::
(PEvalBitCastOrTerm a b) =>
Term b ->
Term a ->
IO (Term b)
curThreadBitCastOrTerm :: forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm d :: Term b
d@Term b
SupportedTerm Term a
a = Uninterned (Term b) -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term b) -> IO (Term b))
-> Uninterned (Term b) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$ Term b -> Term a -> UTerm b
forall b bv.
(SupportedPrim b, PEvalBitCastOrTerm bv b) =>
Term b -> Term bv -> UTerm b
UBitCastOrTerm Term b
d Term a
a
{-# INLINE curThreadBitCastOrTerm #-}
curThreadBVConcatTerm ::
forall bv l r.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r,
SupportedPrim (bv (l + r))
) =>
Term (bv l) ->
Term (bv r) ->
IO (Term (bv (l + r)))
curThreadBVConcatTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm Term (bv l)
l Term (bv r)
r = Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r)))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r))))
-> Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ Term (bv l) -> Term (bv r) -> UTerm (bv (l + r))
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, KnownNat (n + sb),
1 <= n, 1 <= sb, 1 <= (n + sb), SupportedPrim (bv (n + sb))) =>
Term (bv n) -> Term (bv sb) -> UTerm (bv (n + sb))
UBVConcatTerm Term (bv l)
l Term (bv r)
r
{-# INLINE curThreadBVConcatTerm #-}
curThreadBVSelectTerm ::
forall bv n ix w p q.
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
SupportedPrim (bv w)
) =>
p ix ->
q w ->
Term (bv n) ->
IO (Term (bv w))
curThreadBVSelectTerm :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm p ix
_ q w
_ Term (bv n)
v = Uninterned (Term (bv w)) -> IO (Term (bv w))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv w)) -> IO (Term (bv w)))
-> Uninterned (Term (bv w)) -> IO (Term (bv w))
forall a b. (a -> b) -> a -> b
$ Proxy ix -> Proxy w -> Term (bv n) -> UTerm (bv w)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural)
(w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, KnownNat w, 1 <= n,
1 <= w, (sb + w) <= n, SupportedPrim (bv w)) =>
Proxy sb -> Proxy w -> Term (bv n) -> UTerm (bv w)
UBVSelectTerm (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) Term (bv n)
v
{-# INLINE curThreadBVSelectTerm #-}
curThreadBVExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
Bool ->
proxy r ->
Term (bv l) ->
IO (Term (bv r))
curThreadBVExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed proxy r
_ Term (bv l)
v = Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$ Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, 1 <= n, 1 <= sb, n <= sb,
SupportedPrim (bv sb)) =>
Bool -> Proxy sb -> Term (bv n) -> UTerm (bv sb)
UBVExtendTerm Bool
signed (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBVExtendTerm #-}
curThreadBvsignExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
proxy r ->
Term (bv l) ->
IO (Term (bv r))
curThreadBvsignExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvsignExtendTerm proxy r
_ Term (bv l)
v = Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$ Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, 1 <= n, 1 <= sb, n <= sb,
SupportedPrim (bv sb)) =>
Bool -> Proxy sb -> Term (bv n) -> UTerm (bv sb)
UBVExtendTerm Bool
True (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBvsignExtendTerm #-}
curThreadBvzeroExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
proxy r ->
Term (bv l) ->
IO (Term (bv r))
curThreadBvzeroExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvzeroExtendTerm proxy r
_ Term (bv l)
v = Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$ Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (bv :: Natural -> *) (n :: Natural) (sb :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat sb, 1 <= n, 1 <= sb, n <= sb,
SupportedPrim (bv sb)) =>
Bool -> Proxy sb -> Term (bv n) -> UTerm (bv sb)
UBVExtendTerm Bool
False (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBvzeroExtendTerm #-}
curThreadApplyTerm ::
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f ->
Term a ->
IO (Term b)
curThreadApplyTerm :: forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm Term f
f Term a
a = Uninterned (Term b) -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term b) -> IO (Term b))
-> Uninterned (Term b) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$ Term f -> Term a -> UTerm b
forall bv n b.
(PEvalApplyTerm bv n b, SupportedPrim b) =>
Term bv -> Term n -> UTerm b
UApplyTerm Term f
f Term a
a
{-# INLINE curThreadApplyTerm #-}
curThreadDivIntegralTerm ::
(PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UDivIntegralTerm Term a
l Term a
r
{-# INLINE curThreadDivIntegralTerm #-}
curThreadModIntegralTerm ::
(PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UModIntegralTerm Term a
l Term a
r
{-# INLINE curThreadModIntegralTerm #-}
curThreadQuotIntegralTerm ::
(PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UQuotIntegralTerm Term a
l Term a
r
{-# INLINE curThreadQuotIntegralTerm #-}
curThreadRemIntegralTerm ::
(PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
URemIntegralTerm Term a
l Term a
r
{-# INLINE curThreadRemIntegralTerm #-}
curThreadFpTraitTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait ->
Term (fp eb sb) ->
IO (Term Bool)
curThreadFpTraitTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait Term (fp eb sb)
v = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ FPTrait -> Term (fp eb sb) -> UTerm Bool
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
FPTrait -> Term (sb bv n) -> UTerm Bool
UFPTraitTerm FPTrait
trait Term (fp eb sb)
v
{-# INLINE curThreadFpTraitTerm #-}
curThreadFdivTerm :: (PEvalFractionalTerm a) => Term a -> Term a -> IO (Term a)
curThreadFdivTerm :: forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> Term t -> UTerm t
UFdivTerm Term a
l Term a
r
{-# INLINE curThreadFdivTerm #-}
curThreadRecipTerm :: (PEvalFractionalTerm a) => Term a -> IO (Term a)
curThreadRecipTerm :: forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm l :: Term a
l@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> UTerm t
URecipTerm Term a
l
{-# INLINE curThreadRecipTerm #-}
curThreadFloatingUnaryTerm ::
(PEvalFloatingTerm a) => FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm :: forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op a :: Term a
a@Term a
SupportedTerm = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ FloatingUnaryOp -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
FloatingUnaryOp -> Term t -> UTerm t
UFloatingUnaryTerm FloatingUnaryOp
op Term a
a
{-# INLINE curThreadFloatingUnaryTerm #-}
curThreadPowerTerm :: (PEvalFloatingTerm a) => Term a -> Term a -> IO (Term a)
curThreadPowerTerm :: forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm l :: Term a
l@Term a
SupportedTerm Term a
r = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
Term t -> Term t -> UTerm t
UPowerTerm Term a
l Term a
r
{-# INLINE curThreadPowerTerm #-}
curThreadFpUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp ->
Term (fp eb sb) ->
IO (Term (fp eb sb))
curThreadFpUnaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpUnaryTerm FPUnaryOp
op Term (fp eb sb)
v = Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb)))
-> Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall a b. (a -> b) -> a -> b
$ FPUnaryOp -> Term (fp eb sb) -> UTerm (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
FPUnaryOp -> Term (sb bv n) -> UTerm (sb bv n)
UFPUnaryTerm FPUnaryOp
op Term (fp eb sb)
v
{-# INLINE curThreadFpUnaryTerm #-}
curThreadFpBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp ->
Term (fp eb sb) ->
Term (fp eb sb) ->
IO (Term (fp eb sb))
curThreadFpBinaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpBinaryTerm FPBinaryOp
op Term (fp eb sb)
l Term (fp eb sb)
r = Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb)))
-> Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall a b. (a -> b) -> a -> b
$ FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> UTerm (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
FPBinaryOp -> Term (sb bv n) -> Term (sb bv n) -> UTerm (sb bv n)
UFPBinaryTerm FPBinaryOp
op Term (fp eb sb)
l Term (fp eb sb)
r
{-# INLINE curThreadFpBinaryTerm #-}
curThreadFpRoundingUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
IO (Term (fp eb sb))
curThreadFpRoundingUnaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
v = Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb)))
-> Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall a b. (a -> b) -> a -> b
$ FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> UTerm (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (sb bv n) -> UTerm (sb bv n)
UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
v
{-# INLINE curThreadFpRoundingUnaryTerm #-}
curThreadFpRoundingBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
IO (Term (fp eb sb))
curThreadFpRoundingBinaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
l Term (fp eb sb)
r =
Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb)))
-> Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall a b. (a -> b) -> a -> b
$ FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> UTerm (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (sb bv n)
-> Term (sb bv n)
-> UTerm (sb bv n)
UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (fp eb sb)
l Term (fp eb sb)
r
{-# INLINE curThreadFpRoundingBinaryTerm #-}
curThreadFpFMATerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb) ->
IO (Term (fp eb sb))
curThreadFpFMATerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
curThreadFpFMATerm Term FPRoundingMode
mode Term (fp eb sb)
l Term (fp eb sb)
r Term (fp eb sb)
s = Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb)))
-> Uninterned (Term (fp eb sb)) -> IO (Term (fp eb sb))
forall a b. (a -> b) -> a -> b
$ Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> UTerm (fp eb sb)
forall (bv :: Natural) (n :: Natural)
(sb :: Natural -> Natural -> *).
(ValidFP bv n, SupportedPrim (sb bv n), PEvalFPTerm sb) =>
Term FPRoundingMode
-> Term (sb bv n)
-> Term (sb bv n)
-> Term (sb bv n)
-> UTerm (sb bv n)
UFPFMATerm Term FPRoundingMode
mode Term (fp eb sb)
l Term (fp eb sb)
r Term (fp eb sb)
s
{-# INLINE curThreadFpFMATerm #-}
curThreadFromIntegralTerm ::
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a ->
IO (Term b)
curThreadFromIntegralTerm :: forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm = Uninterned (Term b) -> IO (Term b)
UTerm b -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm b -> IO (Term b))
-> (Term a -> UTerm b) -> Term a -> IO (Term b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term a -> UTerm b
forall bv b.
(PEvalFromIntegralTerm bv b, SupportedPrim b) =>
Term bv -> UTerm b
UFromIntegralTerm
{-# INLINE curThreadFromIntegralTerm #-}
curThreadFromFPOrTerm ::
forall a eb sb.
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb
) =>
Term a ->
Term FPRoundingMode ->
Term (FP eb sb) ->
IO (Term a)
curThreadFromFPOrTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm d :: Term a
d@Term a
SupportedTerm Term FPRoundingMode
r Term (FP eb sb)
f = Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term FPRoundingMode -> Term (FP eb sb) -> UTerm a
forall a (bv :: Natural) (n :: Natural).
(PEvalIEEEFPConvertibleTerm a, SupportedPrim a, ValidFP bv n) =>
Term a -> Term FPRoundingMode -> Term (FP bv n) -> UTerm a
UFromFPOrTerm Term a
d Term FPRoundingMode
r Term (FP eb sb)
f
{-# INLINE curThreadFromFPOrTerm #-}
curThreadToFPTerm ::
forall a eb sb.
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim (FP eb sb)
) =>
Term FPRoundingMode ->
Term a ->
IO (Term (FP eb sb))
curThreadToFPTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm Term FPRoundingMode
r Term a
f = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ Term FPRoundingMode
-> Term a -> Proxy eb -> Proxy sb -> UTerm (FP eb sb)
forall bv (n :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm bv, ValidFP n sb,
SupportedPrim (FP n sb)) =>
Term FPRoundingMode
-> Term bv -> Proxy n -> Proxy sb -> UTerm (FP n sb)
UToFPTerm Term FPRoundingMode
r Term a
f (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @eb) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @sb)
{-# INLINE curThreadToFPTerm #-}
inCurThread1 ::
forall a b.
(Term a -> IO (Term b)) ->
Term a ->
IO (Term b)
inCurThread1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
inCurThread1 Term a -> IO (Term b)
f Term a
t = do
tid <- IO WeakThreadId
myWeakThreadId
toCurThreadImpl tid t >>= f
{-# INLINE inCurThread1 #-}
inCurThread2 ::
forall a b c.
(Term a -> Term b -> IO (Term c)) ->
Term a ->
Term b ->
IO (Term c)
inCurThread2 :: forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
inCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b = do
tid <- IO WeakThreadId
myWeakThreadId
ra <- toCurThreadImpl tid a
rb <- toCurThreadImpl tid b
f ra rb
{-# INLINE inCurThread2 #-}
inCurThread3 ::
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d)) ->
Term a ->
Term b ->
Term c ->
IO (Term d)
inCurThread3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
inCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c = do
tid <- IO WeakThreadId
myWeakThreadId
ra <- toCurThreadImpl tid a
rb <- toCurThreadImpl tid b
rc <- toCurThreadImpl tid c
f ra rb rc
{-# INLINE inCurThread3 #-}
unsafeInCurThread1 ::
forall a b.
(Term a -> IO (Term b)) ->
Term a ->
Term b
unsafeInCurThread1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
f = IO (Term b) -> Term b
forall a. IO a -> a
unsafePerformIO (IO (Term b) -> Term b)
-> (Term a -> IO (Term b)) -> Term a -> Term b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
inCurThread1 Term a -> IO (Term b)
f
{-# NOINLINE unsafeInCurThread1 #-}
unsafeInCurThread2 ::
forall a b c.
(Term a -> Term b -> IO (Term c)) ->
Term a ->
Term b ->
Term c
unsafeInCurThread2 :: forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b = IO (Term c) -> Term c
forall a. IO a -> a
unsafePerformIO (IO (Term c) -> Term c) -> IO (Term c) -> Term c
forall a b. (a -> b) -> a -> b
$ (Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
inCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b
{-# NOINLINE unsafeInCurThread2 #-}
unsafeInCurThread3 ::
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d)) ->
Term a ->
Term b ->
Term c ->
Term d
unsafeInCurThread3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c = IO (Term d) -> Term d
forall a. IO a -> a
unsafePerformIO (IO (Term d) -> Term d) -> IO (Term d) -> Term d
forall a b. (a -> b) -> a -> b
$ (Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
inCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c
{-# NOINLINE unsafeInCurThread3 #-}
conTerm :: (SupportedPrim t) => t -> Term t
conTerm :: forall t. SupportedPrim t => t -> Term t
conTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t) -> (t -> IO (Term t)) -> t -> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> IO (Term t)
forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm
{-# NOINLINE conTerm #-}
symTerm :: TypedSymbol knd t -> Term t
symTerm :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> Term t
symTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t)
-> (TypedSymbol knd t -> IO (Term t))
-> TypedSymbol knd t
-> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TypedSymbol knd t -> IO (Term t)
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm
{-# NOINLINE symTerm #-}
forallTerm ::
TypedSymbol 'ConstantKind t ->
Term Bool ->
Term Bool
forallTerm :: forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forallTerm sym :: TypedSymbol 'ConstantKind t
sym@TypedSymbol {} = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym)
{-# NOINLINE forallTerm #-}
existsTerm ::
TypedSymbol 'ConstantKind t ->
Term Bool ->
Term Bool
existsTerm :: forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
existsTerm sym :: TypedSymbol 'ConstantKind t
sym@TypedSymbol {} = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym)
{-# NOINLINE existsTerm #-}
ssymTerm :: (SupportedPrim t) => Identifier -> Term t
ssymTerm :: forall t. SupportedPrim t => Identifier -> Term t
ssymTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t)
-> (Identifier -> IO (Term t)) -> Identifier -> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identifier -> IO (Term t)
forall t. SupportedPrim t => Identifier -> IO (Term t)
curThreadSsymTerm
{-# NOINLINE ssymTerm #-}
isymTerm :: (SupportedPrim t) => Identifier -> Int -> Term t
isymTerm :: forall t. SupportedPrim t => Identifier -> Int -> Term t
isymTerm Identifier
ident Int
index = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t) -> IO (Term t) -> Term t
forall a b. (a -> b) -> a -> b
$ Identifier -> Int -> IO (Term t)
forall t. SupportedPrim t => Identifier -> Int -> IO (Term t)
curThreadIsymTerm Identifier
ident Int
index
{-# NOINLINE isymTerm #-}
notTerm :: Term Bool -> Term Bool
notTerm :: Term Bool -> Term Bool
notTerm = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term Bool -> IO (Term Bool)
curThreadNotTerm
{-# NOINLINE notTerm #-}
inCurThread2Set ::
forall a c.
(Term a -> Term a -> HS.HashSet (Term a) -> IO (Term c)) ->
Term a ->
Term a ->
HS.HashSet (Term a) ->
IO (Term c)
inCurThread2Set :: forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
inCurThread2Set Term a -> Term a -> HashSet (Term a) -> IO (Term c)
f Term a
a Term a
b HashSet (Term a)
s = do
tid <- IO WeakThreadId
myWeakThreadId
ra@SupportedTerm <- toCurThreadImpl tid a
rb <- toCurThreadImpl tid b
rs <- traverse (toCurThreadImpl tid) (HS.toList s)
f ra rb (HS.fromList rs)
{-# INLINE inCurThread2Set #-}
unsafeInCurThread2Set ::
forall a c.
(Term a -> Term a -> HS.HashSet (Term a) -> IO (Term c)) ->
Term a ->
Term a ->
HS.HashSet (Term a) ->
Term c
unsafeInCurThread2Set :: forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set Term a -> Term a -> HashSet (Term a) -> IO (Term c)
f Term a
a Term a
b HashSet (Term a)
s = IO (Term c) -> Term c
forall a. IO a -> a
unsafePerformIO (IO (Term c) -> Term c) -> IO (Term c) -> Term c
forall a b. (a -> b) -> a -> b
$ (Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> IO (Term c)
inCurThread2Set Term a -> Term a -> HashSet (Term a) -> IO (Term c)
f Term a
a Term a
b HashSet (Term a)
s
{-# NOINLINE unsafeInCurThread2Set #-}
orTerm :: Term Bool -> Term Bool -> Term Bool
orTerm :: Term Bool -> Term Bool -> Term Bool
orTerm l :: Term Bool
l@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s1) r :: Term Bool
r@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s2 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
HS.union HashSet (Term Bool)
s1 HashSet (Term Bool)
s2
)
orTerm l :: Term Bool
l@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s1) Term Bool
r =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l HashSet (Term Bool)
s1
)
orTerm Term Bool
l r :: Term Bool
r@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s2 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r HashSet (Term Bool)
s2
)
orTerm Term Bool
l Term Bool
r = (Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadOrTerm Term Bool
l Term Bool
r ([Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r])
{-# NOINLINE orTerm #-}
andTerm :: Term Bool -> Term Bool -> Term Bool
andTerm :: Term Bool -> Term Bool -> Term Bool
andTerm l :: Term Bool
l@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s1) r :: Term Bool
r@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s2 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
HS.union HashSet (Term Bool)
s1 HashSet (Term Bool)
s2
)
andTerm l :: Term Bool
l@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s1) Term Bool
r =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s1 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l HashSet (Term Bool)
s1
)
andTerm Term Bool
l r :: Term Bool
r@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) =
(Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set
Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm
Term Bool
l
Term Bool
r
( if HashSet (Term Bool) -> Int
forall a. HashSet a -> Int
HS.size HashSet (Term Bool)
s2 Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
30
then [Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r]
else Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
l (HashSet (Term Bool) -> HashSet (Term Bool))
-> HashSet (Term Bool) -> HashSet (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => a -> HashSet a -> HashSet a
HS.insert Term Bool
r HashSet (Term Bool)
s2
)
andTerm Term Bool
l Term Bool
r = (Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool))
-> Term Bool -> Term Bool -> HashSet (Term Bool) -> Term Bool
forall a c.
(Term a -> Term a -> HashSet (Term a) -> IO (Term c))
-> Term a -> Term a -> HashSet (Term a) -> Term c
unsafeInCurThread2Set Term Bool -> Term Bool -> HashSet (Term Bool) -> IO (Term Bool)
curThreadAndTerm Term Bool
l Term Bool
r ([Term Bool] -> HashSet (Term Bool)
forall a. (Eq a, Hashable a) => [a] -> HashSet a
HS.fromList [Term Bool
l, Term Bool
r])
{-# NOINLINE andTerm #-}
eqTerm :: Term a -> Term a -> Term Bool
eqTerm :: forall a. Term a -> Term a -> Term Bool
eqTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm
{-# NOINLINE eqTerm #-}
distinctTerm :: NonEmpty (Term a) -> Term Bool
distinctTerm :: forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term a)
args =
IO (Term Bool) -> Term Bool
forall a. IO a -> a
unsafePerformIO (IO (Term Bool) -> Term Bool) -> IO (Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$ do
tid <- IO WeakThreadId
myWeakThreadId
traverse (toCurThreadImpl tid) args >>= curThreadDistinctTerm
{-# NOINLINE distinctTerm #-}
iteTerm :: Term Bool -> Term a -> Term a -> Term a
iteTerm :: forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm = (Term Bool -> Term a -> Term a -> IO (Term a))
-> Term Bool -> Term a -> Term a -> Term a
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term Bool -> Term a -> Term a -> IO (Term a)
forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm
{-# NOINLINE iteTerm #-}
addNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
addNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm
{-# NOINLINE addNumTerm #-}
negNumTerm :: (PEvalNumTerm a) => Term a -> Term a
negNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
negNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm
{-# NOINLINE negNumTerm #-}
mulNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
mulNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm
{-# NOINLINE mulNumTerm #-}
absNumTerm :: (PEvalNumTerm a) => Term a -> Term a
absNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
absNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm
{-# NOINLINE absNumTerm #-}
signumNumTerm :: (PEvalNumTerm a) => Term a -> Term a
signumNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
signumNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm
{-# NOINLINE signumNumTerm #-}
ltOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
ltOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
ltOrdTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm
{-# NOINLINE ltOrdTerm #-}
leOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
leOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
leOrdTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm
{-# NOINLINE leOrdTerm #-}
andBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
andBitsTerm :: forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term a
a Term a
b =
(Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm Term a
a Term a
b
{-# NOINLINE andBitsTerm #-}
orBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
orBitsTerm :: forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm
{-# NOINLINE orBitsTerm #-}
xorBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
xorBitsTerm :: forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
xorBitsTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm
{-# NOINLINE xorBitsTerm #-}
complementBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a
complementBitsTerm :: forall t. PEvalBitwiseTerm t => Term t -> Term t
complementBitsTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm
{-# NOINLINE complementBitsTerm #-}
shiftLeftTerm :: (PEvalShiftTerm a) => Term a -> Term a -> Term a
shiftLeftTerm :: forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
shiftLeftTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm
{-# NOINLINE shiftLeftTerm #-}
shiftRightTerm :: (PEvalShiftTerm a) => Term a -> Term a -> Term a
shiftRightTerm :: forall t. PEvalShiftTerm t => Term t -> Term t -> Term t
shiftRightTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm
{-# NOINLINE shiftRightTerm #-}
rotateLeftTerm :: (PEvalRotateTerm a) => Term a -> Term a -> Term a
rotateLeftTerm :: forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
rotateLeftTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm
{-# NOINLINE rotateLeftTerm #-}
rotateRightTerm :: (PEvalRotateTerm a) => Term a -> Term a -> Term a
rotateRightTerm :: forall t. PEvalRotateTerm t => Term t -> Term t -> Term t
rotateRightTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm
{-# NOINLINE rotateRightTerm #-}
bitCastTerm ::
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a ->
Term b
bitCastTerm :: forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm = (Term a -> IO (Term b)) -> Term a -> Term b
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm
{-# NOINLINE bitCastTerm #-}
bitCastOrTerm ::
(PEvalBitCastOrTerm a b) =>
Term b ->
Term a ->
Term b
bitCastOrTerm :: forall a b. PEvalBitCastOrTerm a b => Term b -> Term a -> Term b
bitCastOrTerm = (Term b -> Term a -> IO (Term b)) -> Term b -> Term a -> Term b
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term b -> Term a -> IO (Term b)
forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm
{-# NOINLINE bitCastOrTerm #-}
bvConcatTerm ::
forall bv l r.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= l + r,
SupportedPrim (bv (l + r))
) =>
Term (bv l) ->
Term (bv r) ->
Term (bv (l + r))
bvConcatTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm = (Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r))))
-> Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm
{-# NOINLINE bvConcatTerm #-}
bvSelectTerm ::
forall bv n ix w p q.
( PEvalBVTerm bv,
KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
SupportedPrim (bv w)
) =>
p ix ->
q w ->
Term (bv n) ->
Term (bv w)
bvSelectTerm :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
bvSelectTerm p ix
ix q w
w = (Term (bv n) -> IO (Term (bv w))) -> Term (bv n) -> Term (bv w)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (p ix -> q w -> Term (bv n) -> IO (Term (bv w))
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm p ix
ix q w
w)
{-# NOINLINE bvSelectTerm #-}
bvExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
Bool ->
proxy r ->
Term (bv l) ->
Term (bv r)
bvExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
signed proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed proxy r
r)
{-# NOINLINE bvExtendTerm #-}
bvsignExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
proxy r ->
Term (bv l) ->
Term (bv r)
bvsignExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> Term (bv r)
bvsignExtendTerm proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvsignExtendTerm proxy r
r)
{-# NOINLINE bvsignExtendTerm #-}
bvzeroExtendTerm ::
forall bv l r proxy.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
SupportedPrim (bv r)
) =>
proxy r ->
Term (bv l) ->
Term (bv r)
bvzeroExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> Term (bv r)
bvzeroExtendTerm proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvzeroExtendTerm proxy r
r)
{-# NOINLINE bvzeroExtendTerm #-}
applyTerm ::
(PEvalApplyTerm f a b, SupportedPrim b) => Term f -> Term a -> Term b
applyTerm :: forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> Term b
applyTerm = (Term f -> Term a -> IO (Term b)) -> Term f -> Term a -> Term b
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term f -> Term a -> IO (Term b)
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm
{-# NOINLINE applyTerm #-}
divIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
divIntegralTerm :: forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
divIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm
{-# NOINLINE divIntegralTerm #-}
modIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
modIntegralTerm :: forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
modIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm
{-# NOINLINE modIntegralTerm #-}
quotIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
quotIntegralTerm :: forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
quotIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm
{-# NOINLINE quotIntegralTerm #-}
remIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
remIntegralTerm :: forall t. PEvalDivModIntegralTerm t => Term t -> Term t -> Term t
remIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm
{-# NOINLINE remIntegralTerm #-}
fpTraitTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait ->
Term (fp eb sb) ->
Term Bool
fpTraitTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> Term Bool
fpTraitTerm FPTrait
trait = (Term (fp eb sb) -> IO (Term Bool)) -> Term (fp eb sb) -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FPTrait -> Term (fp eb sb) -> IO (Term Bool)
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPTrait -> Term (fp eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait)
{-# NOINLINE fpTraitTerm #-}
fdivTerm :: (PEvalFractionalTerm a) => Term a -> Term a -> Term a
fdivTerm :: forall t. PEvalFractionalTerm t => Term t -> Term t -> Term t
fdivTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm
{-# NOINLINE fdivTerm #-}
recipTerm :: (PEvalFractionalTerm a) => Term a -> Term a
recipTerm :: forall t. PEvalFractionalTerm t => Term t -> Term t
recipTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm
{-# NOINLINE recipTerm #-}
floatingUnaryTerm :: (PEvalFloatingTerm a) => FloatingUnaryOp -> Term a -> Term a
floatingUnaryTerm :: forall t.
PEvalFloatingTerm t =>
FloatingUnaryOp -> Term t -> Term t
floatingUnaryTerm FloatingUnaryOp
op = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FloatingUnaryOp -> Term a -> IO (Term a)
forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op)
{-# NOINLINE floatingUnaryTerm #-}
powerTerm :: (PEvalFloatingTerm a) => Term a -> Term a -> Term a
powerTerm :: forall t. PEvalFloatingTerm t => Term t -> Term t -> Term t
powerTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm
{-# NOINLINE powerTerm #-}
fpUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp ->
Term (fp eb sb) ->
Term (fp eb sb)
fpUnaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> Term (fp eb sb)
fpUnaryTerm FPUnaryOp
op = (Term (fp eb sb) -> IO (Term (fp eb sb)))
-> Term (fp eb sb) -> Term (fp eb sb)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FPUnaryOp -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPUnaryOp -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpUnaryTerm FPUnaryOp
op)
{-# NOINLINE fpUnaryTerm #-}
fpBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
fpBinaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp -> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
fpBinaryTerm FPBinaryOp
op = (Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb)))
-> Term (fp eb sb) -> Term (fp eb sb) -> Term (fp eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 (FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPBinaryOp
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpBinaryTerm FPBinaryOp
op)
{-# NOINLINE fpBinaryTerm #-}
fpRoundingUnaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb)
fpRoundingUnaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
fpRoundingUnaryTerm FPRoundingUnaryOp
op = (Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb)))
-> Term FPRoundingMode -> Term (fp eb sb) -> Term (fp eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 (FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (fp eb sb) -> IO (Term (fp eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op)
{-# NOINLINE fpRoundingUnaryTerm #-}
fpRoundingBinaryTerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp ->
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
fpRoundingBinaryTerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
fpRoundingBinaryTerm FPRoundingBinaryOp
op = (Term FPRoundingMode
-> Term (fp eb sb) -> Term (fp eb sb) -> IO (Term (fp eb sb)))
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 (FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> IO (Term (fp eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op)
{-# NOINLINE fpRoundingBinaryTerm #-}
fpFMATerm ::
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb) ->
Term (fp eb sb)
fpFMATerm :: forall (eb :: Natural) (sb :: Natural)
(fp :: Natural -> Natural -> *).
(ValidFP eb sb, SupportedPrim (fp eb sb), PEvalFPTerm fp) =>
Term FPRoundingMode
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
-> Term (fp eb sb)
fpFMATerm Term FPRoundingMode
mode Term (fp eb sb)
a Term (fp eb sb)
b Term (fp eb sb)
c = IO (Term (fp eb sb)) -> Term (fp eb sb)
forall a. IO a -> a
unsafePerformIO (IO (Term (fp eb sb)) -> Term (fp eb sb))
-> IO (Term (fp eb sb)) -> Term (fp eb sb)
forall a b. (a -> b) -> a -> b
$ do
tid <- IO WeakThreadId
myWeakThreadId
mode' <- toCurThreadImpl tid mode
a' <- toCurThreadImpl tid a
b' <- toCurThreadImpl tid b
c' <- toCurThreadImpl tid c
curThreadFpFMATerm mode' a' b' c'
{-# NOINLINE fpFMATerm #-}
fromIntegralTerm ::
(PEvalFromIntegralTerm a b, SupportedPrim b) => Term a -> Term b
fromIntegralTerm :: forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> Term b
fromIntegralTerm = (Term a -> IO (Term b)) -> Term a -> Term b
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm
{-# NOINLINE fromIntegralTerm #-}
fromFPOrTerm ::
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb
) =>
Term a ->
Term FPRoundingMode ->
Term (FP eb sb) ->
Term a
fromFPOrTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
fromFPOrTerm = (Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a))
-> Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm
{-# NOINLINE fromFPOrTerm #-}
toFPTerm ::
forall a eb sb.
( PEvalIEEEFPConvertibleTerm a,
ValidFP eb sb,
SupportedPrim (FP eb sb)
) =>
Term FPRoundingMode ->
Term a ->
Term (FP eb sb)
toFPTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
toFPTerm = (Term FPRoundingMode -> Term a -> IO (Term (FP eb sb)))
-> Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm
{-# NOINLINE toFPTerm #-}
defaultValueForBool :: Bool
defaultValueForBool :: Bool
defaultValueForBool = Bool
False
trueTerm :: Term Bool
trueTerm :: Term Bool
trueTerm = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
{-# NOINLINE trueTerm #-}
falseTerm :: Term Bool
falseTerm :: Term Bool
falseTerm = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
False
{-# NOINLINE falseTerm #-}
boolConTermView :: forall a. Term a -> Maybe Bool
boolConTermView :: forall a. Term a -> Maybe Bool
boolConTermView (ConTerm a
b) = a -> Maybe Bool
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a
b
boolConTermView Term a
_ = Maybe Bool
forall a. Maybe a
Nothing
{-# INLINE boolConTermView #-}
pattern BoolConTerm :: Bool -> Term a
pattern $mBoolConTerm :: forall {r} {a}. Term a -> (Bool -> r) -> ((# #) -> r) -> r
BoolConTerm b <- (boolConTermView -> Just b)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BoolConTerm #-}
#endif
pattern TrueTerm :: Term a
pattern $mTrueTerm :: forall {r} {a}. Term a -> ((# #) -> r) -> ((# #) -> r) -> r
TrueTerm <- BoolConTerm True
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE TrueTerm #-}
#endif
pattern FalseTerm :: Term a
pattern $mFalseTerm :: forall {r} {a}. Term a -> ((# #) -> r) -> ((# #) -> r) -> r
FalseTerm <- BoolConTerm False
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE FalseTerm #-}
#endif
boolTermView :: forall a. Term a -> Maybe (Term Bool)
boolTermView :: forall a. Term a -> Maybe (Term Bool)
boolTermView t :: Term a
t@Term a
SupportedTerm = Term a -> Maybe (Term Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast Term a
t
{-# INLINE boolTermView #-}
pattern BoolTerm :: Term Bool -> Term a
pattern $mBoolTerm :: forall {r} {a}. Term a -> (Term Bool -> r) -> ((# #) -> r) -> r
BoolTerm b <- (boolTermView -> Just b)
#if MIN_VERSION_base(4, 16, 4)
{-# INLINE BoolTerm #-}
#endif
pevalNotTerm :: Term Bool -> Term Bool
pevalNotTerm :: Term Bool -> Term Bool
pevalNotTerm (NotTerm Term Bool
tm) = Term Bool
tm
pevalNotTerm (ConTerm Bool
a) = if Bool
a then Term Bool
falseTerm else Term Bool
trueTerm
pevalNotTerm (OrTerm (NotTerm Term Bool
n1) Term Bool
n2) = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
n1 (Term Bool -> Term Bool
pevalNotTerm Term Bool
n2)
pevalNotTerm (OrTerm (DistinctTerm (Term t
n1 :| [Term t
n2])) Term Bool
n3) =
Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n1 Term t
n2) (Term Bool -> Term Bool
pevalNotTerm Term Bool
n3)
pevalNotTerm (OrTerm Term Bool
n1 (NotTerm Term Bool
n2)) = Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) Term Bool
n2
pevalNotTerm (OrTerm Term Bool
n1 (DistinctTerm (Term t
n2 :| [Term t
n3]))) =
Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n2 Term t
n3)
pevalNotTerm (AndTerm (NotTerm Term Bool
n1) Term Bool
n2) = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
n1 (Term Bool -> Term Bool
pevalNotTerm Term Bool
n2)
pevalNotTerm (AndTerm (DistinctTerm (Term t
n1 :| [Term t
n2])) Term Bool
n3) =
Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n1 Term t
n2) (Term Bool -> Term Bool
pevalNotTerm Term Bool
n3)
pevalNotTerm (AndTerm Term Bool
n1 (NotTerm Term Bool
n2)) = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) Term Bool
n2
pevalNotTerm (AndTerm Term Bool
n1 (DistinctTerm (Term t
n2 :| [Term t
n3]))) =
Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n2 Term t
n3)
pevalNotTerm
(EqTerm Term t
a (DynTerm (ConTerm WordN 1
b :: Term (WordN 1))))
| WordN 1
b WordN 1 -> WordN 1 -> Bool
forall a. Eq a => a -> a -> Bool
== WordN 1
0 = Term (WordN 1) -> Term (WordN 1) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm (Term t -> Term (WordN 1)
forall a b. a -> b
unsafeCoerce Term t
a) (WordN 1 -> Term (WordN 1)
forall t. SupportedPrim t => t -> Term t
conTerm WordN 1
1 :: Term (WordN 1))
| WordN 1
b WordN 1 -> WordN 1 -> Bool
forall a. Eq a => a -> a -> Bool
== WordN 1
1 = Term (WordN 1) -> Term (WordN 1) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm (Term t -> Term (WordN 1)
forall a b. a -> b
unsafeCoerce Term t
a) (WordN 1 -> Term (WordN 1)
forall t. SupportedPrim t => t -> Term t
conTerm WordN 1
0 :: Term (WordN 1))
pevalNotTerm
(EqTerm Term t
a (DynTerm (ConTerm IntN 1
b :: Term (IntN 1))))
| IntN 1
b IntN 1 -> IntN 1 -> Bool
forall a. Eq a => a -> a -> Bool
== IntN 1
0 = Term (IntN 1) -> Term (IntN 1) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm (Term t -> Term (IntN 1)
forall a b. a -> b
unsafeCoerce Term t
a) (IntN 1 -> Term (IntN 1)
forall t. SupportedPrim t => t -> Term t
conTerm IntN 1
1 :: Term (IntN 1))
| IntN 1
b IntN 1 -> IntN 1 -> Bool
forall a. Eq a => a -> a -> Bool
== IntN 1
1 = Term (IntN 1) -> Term (IntN 1) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm (Term t -> Term (IntN 1)
forall a b. a -> b
unsafeCoerce Term t
a) (IntN 1 -> Term (IntN 1)
forall t. SupportedPrim t => t -> Term t
conTerm IntN 1
0 :: Term (IntN 1))
pevalNotTerm (DistinctTerm (Term t
a :| [Term t
b])) = Term t -> Term t -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term t
a Term t
b
pevalNotTerm Term Bool
tm = Term Bool -> Term Bool
notTerm Term Bool
tm
{-# INLINEABLE pevalNotTerm #-}
orEqFirst' :: Term Bool -> Term Bool -> Bool
orEqFirst' :: Term Bool -> Term Bool -> Bool
orEqFirst'
(DistinctTerm ((Term t
e1 :: Term a) :| [ec1 :: Term t
ec1@ConTerm {} :: Term b]))
(EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
orEqFirst'
(NotTerm (EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b)))
(EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
orEqFirst' Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE orEqFirst' #-}
orEqFirst :: Term Bool -> Term Bool -> Bool
orEqFirst :: Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
_ (ConTerm Bool
False) = Bool
True
orEqFirst Term Bool
x Term Bool
y
| Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
| Bool
otherwise = Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
x Term Bool
y
{-# INLINE orEqFirst #-}
orEqTrue' :: Term Bool -> Term Bool -> Bool
orEqTrue' :: Term Bool -> Term Bool -> Bool
orEqTrue'
(DistinctTerm ((Term t
e1 :: Term a) :| [ec1 :: Term t
ec1@ConTerm {} :: Term b]))
(DistinctTerm ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
orEqTrue'
(NotTerm (EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b)))
(NotTerm (EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b))))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
orEqTrue' Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE orEqTrue' #-}
orEqTrue :: Term Bool -> Term Bool -> Bool
orEqTrue :: Term Bool -> Term Bool -> Bool
orEqTrue (ConTerm Bool
True) ~Term Bool
_ = Bool
True
orEqTrue Term Bool
_ (ConTerm Bool
True) = Bool
True
orEqTrue (NotTerm Term Bool
l) Term Bool
r | Term Bool
l Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r = Bool
True
orEqTrue Term Bool
l (NotTerm Term Bool
r) | Term Bool
l Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r = Bool
True
orEqTrue Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l Term Bool
r
{-# INLINE orEqTrue #-}
pevalOrTerm :: Term Bool -> Term Bool -> Term Bool
pevalOrTerm :: Term Bool -> Term Bool -> Term Bool
pevalOrTerm (ConTerm Bool
True) ~Term Bool
_ = Term Bool
trueTerm
pevalOrTerm Term Bool
_ (ConTerm Bool
True) = Term Bool
trueTerm
pevalOrTerm (ConTerm Bool
False) Term Bool
y = Term Bool
y
pevalOrTerm Term Bool
x (ConTerm Bool
False) = Term Bool
x
pevalOrTerm (NotTerm Term Bool
x) Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
trueTerm
pevalOrTerm Term Bool
x (NotTerm Term Bool
y) | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
trueTerm
pevalOrTerm Term Bool
x Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
x
pevalOrTerm Term Bool
l ~Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l Term Bool
r = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
l Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
r Term Bool
l = Term Bool
r
pevalOrTerm Term Bool
l r :: Term Bool
r@(OrTermAll Term Bool
r1 Term Bool
r2 HashSet (Term Bool)
s)
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
l HashSet (Term Bool)
s = Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member (Term Bool -> Term Bool
simpleNot Term Bool
l) HashSet (Term Bool)
s = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l Term Bool
r1 = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l Term Bool
r2 = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
r1 Term Bool
l = Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
r2 Term Bool
l = Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r2
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r1
pevalOrTerm l :: Term Bool
l@(OrTermAll Term Bool
l1 Term Bool
l2 HashSet (Term Bool)
s) Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
r HashSet (Term Bool)
s = Term Bool
l
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member (Term Bool -> Term Bool
simpleNot Term Bool
r) HashSet (Term Bool)
s = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l1 Term Bool
r = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqTrue' Term Bool
l2 Term Bool
r = Term Bool
trueTerm
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
l1 Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
l2 Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
r Term Bool
l1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqFirst' Term Bool
r Term Bool
l2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r
pevalOrTerm (AndTerm Term Bool
l1 Term Bool
l2) (AndTerm Term Bool
r1 Term Bool
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r1)
| Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r2)
| Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r1)
pevalOrTerm Term Bool
l (AndTermAll Term Bool
r1 Term Bool
r2 HashSet (Term Bool)
s)
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
l HashSet (Term Bool)
s = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r1 = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r2 = Term Bool
l
| Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r2
| Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r1
pevalOrTerm (AndTermAll Term Bool
l1 Term Bool
l2 HashSet (Term Bool)
s) Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
r HashSet (Term Bool)
s = Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l1 = Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l2 = Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l1 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r
| Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l2 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r
pevalOrTerm
(AndTerm nl1 :: Term Bool
nl1@(NotTerm Term Bool
l1) Term Bool
l2)
(EqTerm (DynTerm (Term Bool
e1 :: Term Bool)) (DynTerm (Term Bool
e2 :: Term Bool)))
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e1 Bool -> Bool -> Bool
&& Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
nl1 Term Bool
l2
pevalOrTerm (NotTerm Term Bool
nl) (NotTerm Term Bool
nr) =
Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
nl Term Bool
nr
pevalOrTerm (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
sa) r :: Term Bool
r@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
so)
| HashSet (Term Bool)
sa HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
`HS.intersection` HashSet (Term Bool)
so HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. Eq a => a -> a -> Bool
/= HashSet (Term Bool)
forall a. HashSet a
HS.empty = Term Bool
r
pevalOrTerm l :: Term Bool
l@(OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
so) (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
sa)
| HashSet (Term Bool)
sa HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
`HS.intersection` HashSet (Term Bool)
so HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. Eq a => a -> a -> Bool
/= HashSet (Term Bool)
forall a. HashSet a
HS.empty = Term Bool
l
pevalOrTerm
(EqTerm Term t
a (BVTerm bt :: Term (bv n)
bt@(ConTerm (bv n
b :: bv n))))
(EqTerm Term t
c (DynTerm (BVTerm (ConTerm bv n
d) :: Term (bv n))))
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
b bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== -bv n
1 Bool -> Bool -> Bool
&& bv n
d bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== -bv n
1 =
Term (bv n) -> Term (bv n) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm
( Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
a :: Term (bv n))
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
c :: Term (bv n))
)
Term (bv n)
bt
pevalOrTerm
(EqTerm Term t
a (BVTerm bt :: Term (bv n)
bt@(ConTerm (bv n
b :: bv n))))
(EqTerm Term t
c (DynTerm (BVTerm (ConTerm bv n
d) :: Term (bv n))))
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
b bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
d bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 =
Term (bv n) -> Term (bv n) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm
( Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
a :: Term (bv n))
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
c :: Term (bv n))
)
Term (bv n)
bt
pevalOrTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
orTerm Term Bool
l Term Bool
r
{-# INLINEABLE pevalOrTerm #-}
andEqFalse' :: Term Bool -> Term Bool -> Bool
andEqFalse' :: Term Bool -> Term Bool -> Bool
andEqFalse'
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
andEqFalse' Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE andEqFalse' #-}
andEqFalse :: Term Bool -> Term Bool -> Bool
andEqFalse :: Term Bool -> Term Bool -> Bool
andEqFalse (NotTerm Term Bool
x) Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
andEqFalse Term Bool
x (NotTerm Term Bool
y) | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
andEqFalse Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l Term Bool
r
{-# INLINE andEqFalse #-}
andEqFirst' :: Term Bool -> Term Bool -> Bool
andEqFirst' :: Term Bool -> Term Bool -> Bool
andEqFirst'
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(DistinctTerm ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
andEqFirst'
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(NotTerm (EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b))))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
andEqFirst' Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE andEqFirst' #-}
andEqFirst :: Term Bool -> Term Bool -> Bool
andEqFirst :: Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
_ (ConTerm Bool
True) = Bool
True
andEqFirst Term Bool
x Term Bool
y
| Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
| Bool
otherwise = Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
x Term Bool
y
{-# INLINE andEqFirst #-}
simpleNot :: Term Bool -> Term Bool
simpleNot :: Term Bool -> Term Bool
simpleNot (NotTerm Term Bool
n) = Term Bool
n
simpleNot Term Bool
n = Term Bool -> Term Bool
notTerm Term Bool
n
{-# INLINEABLE simpleNot #-}
pevalAndTerm :: Term Bool -> Term Bool -> Term Bool
pevalAndTerm :: Term Bool -> Term Bool -> Term Bool
pevalAndTerm (ConTerm Bool
False) ~Term Bool
_ = Term Bool
falseTerm
pevalAndTerm Term Bool
_ (ConTerm Bool
False) = Term Bool
falseTerm
pevalAndTerm (ConTerm Bool
True) Term Bool
y = Term Bool
y
pevalAndTerm Term Bool
x (ConTerm Bool
True) = Term Bool
x
pevalAndTerm (NotTerm Term Bool
x) Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
falseTerm
pevalAndTerm Term Bool
x (NotTerm Term Bool
y) | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
falseTerm
pevalAndTerm Term Bool
x Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Term Bool
x
pevalAndTerm Term Bool
l ~Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l Term Bool
r = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
l Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
r Term Bool
l = Term Bool
r
pevalAndTerm Term Bool
l r :: Term Bool
r@(AndTermAll Term Bool
r1 Term Bool
r2 HashSet (Term Bool)
s)
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
l HashSet (Term Bool)
s = Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member (Term Bool -> Term Bool
simpleNot Term Bool
l) HashSet (Term Bool)
s = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l Term Bool
r1 = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l Term Bool
r2 = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
r1 Term Bool
l = Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
r2 Term Bool
l = Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r2
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r1
pevalAndTerm l :: Term Bool
l@(AndTermAll Term Bool
l1 Term Bool
l2 HashSet (Term Bool)
s) Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
r HashSet (Term Bool)
s = Term Bool
l
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member (Term Bool -> Term Bool
simpleNot Term Bool
r) HashSet (Term Bool)
s = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l1 Term Bool
r = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFalse' Term Bool
l2 Term Bool
r = Term Bool
falseTerm
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
l1 Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
l2 Term Bool
r = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
r Term Bool
l1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFirst' Term Bool
r Term Bool
l2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r
pevalAndTerm (OrTerm Term Bool
l1 Term Bool
l2) (OrTerm Term Bool
r1 Term Bool
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r1)
| Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r2)
| Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r1)
pevalAndTerm Term Bool
l (OrTermAll Term Bool
r1 Term Bool
r2 HashSet (Term Bool)
s)
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
l HashSet (Term Bool)
s = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r1 = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r2 = Term Bool
l
| Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r2
| Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r1
pevalAndTerm (OrTermAll Term Bool
l1 Term Bool
l2 HashSet (Term Bool)
s) Term Bool
r
| Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
r HashSet (Term Bool)
s = Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l1 = Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l2 = Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l1 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r
| Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l2 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r
pevalAndTerm
(OrTerm Term Bool
l1 nl2 :: Term Bool
nl2@(NotTerm Term Bool
l2))
(NotTerm (EqTerm (DynTerm (Term Bool
e1 :: Term Bool)) (DynTerm (Term Bool
e2 :: Term Bool))))
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e1 Bool -> Bool -> Bool
&& Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
nl2
pevalAndTerm (NotTerm Term Bool
nl) (NotTerm Term Bool
nr) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
nl Term Bool
nr
pevalAndTerm (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
so) r :: Term Bool
r@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
sa)
| HashSet (Term Bool)
sa HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
`HS.intersection` HashSet (Term Bool)
so HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. Eq a => a -> a -> Bool
/= HashSet (Term Bool)
forall a. HashSet a
HS.empty = Term Bool
r
pevalAndTerm l :: Term Bool
l@(AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
sa) (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
so)
| HashSet (Term Bool)
sa HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
`HS.intersection` HashSet (Term Bool)
so HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. Eq a => a -> a -> Bool
/= HashSet (Term Bool)
forall a. HashSet a
HS.empty = Term Bool
l
pevalAndTerm
(EqTerm Term t
a (BVTerm bt :: Term (bv n)
bt@(ConTerm (bv n
b :: bv n))))
(EqTerm Term t
c (DynTerm (BVTerm (ConTerm bv n
d) :: Term (bv n))))
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
b bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
d bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 =
Term (bv n) -> Term (bv n) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm
( Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
a :: Term (bv n))
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
c :: Term (bv n))
)
Term (bv n)
bt
pevalAndTerm
(EqTerm Term t
a (BVTerm bt :: Term (bv n)
bt@(ConTerm (bv n
b :: bv n))))
(EqTerm Term t
c (DynTerm (BVTerm (ConTerm bv n
d) :: Term (bv n))))
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
b bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== -bv n
1 Bool -> Bool -> Bool
&& bv n
d bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== -bv n
1 =
Term (bv n) -> Term (bv n) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm
( Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
a :: Term (bv n))
(Term t -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term t
c :: Term (bv n))
)
Term (bv n)
bt
pevalAndTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
andTerm Term Bool
l Term Bool
r
{-# INLINEABLE pevalAndTerm #-}
data BVTermView where
BVTermView ::
forall bv n.
( KnownNat n,
1 <= n,
PEvalBitwiseTerm (bv n),
Eq (bv n),
Num (bv n)
) =>
Term (bv n) -> BVTermView
bvTermViewPattern ::
forall a.
(SupportedPrim a) =>
Term a ->
Maybe BVTermView
bvTermViewPattern :: forall a. SupportedPrim a => Term a -> Maybe BVTermView
bvTermViewPattern Term a
b = case forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
R.typeRep @a of
R.App TypeRep a
i TypeRep b
_ -> case ( TypeRep a -> TypeRep IntN -> Maybe (a :~~: IntN)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
R.eqTypeRep TypeRep a
i (forall {k} (a :: k). Typeable a => TypeRep a
forall (a :: Natural -> *). Typeable a => TypeRep a
R.typeRep @IntN),
TypeRep a -> TypeRep WordN -> Maybe (a :~~: WordN)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
R.eqTypeRep TypeRep a
i (forall {k} (a :: k). Typeable a => TypeRep a
forall (a :: Natural -> *). Typeable a => TypeRep a
R.typeRep @WordN)
) of
(Just a :~~: IntN
R.HRefl, Maybe (a :~~: WordN)
_) -> forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @a (((PrimConstraint a, SMTDefinable (SBVType a),
Mergeable (SBVType a), Typeable (SBVType a)) =>
Maybe BVTermView)
-> Maybe BVTermView)
-> ((PrimConstraint a, SMTDefinable (SBVType a),
Mergeable (SBVType a), Typeable (SBVType a)) =>
Maybe BVTermView)
-> Maybe BVTermView
forall a b. (a -> b) -> a -> b
$ BVTermView -> Maybe BVTermView
forall a. a -> Maybe a
Just (Term (IntN b) -> BVTermView
forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n, PEvalBitwiseTerm (bv n), Eq (bv n),
Num (bv n)) =>
Term (bv n) -> BVTermView
BVTermView Term a
Term (IntN b)
b)
(Maybe (a :~~: IntN)
_, Just a :~~: WordN
R.HRefl) -> forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @a (((PrimConstraint a, SMTDefinable (SBVType a),
Mergeable (SBVType a), Typeable (SBVType a)) =>
Maybe BVTermView)
-> Maybe BVTermView)
-> ((PrimConstraint a, SMTDefinable (SBVType a),
Mergeable (SBVType a), Typeable (SBVType a)) =>
Maybe BVTermView)
-> Maybe BVTermView
forall a b. (a -> b) -> a -> b
$ BVTermView -> Maybe BVTermView
forall a. a -> Maybe a
Just (Term (WordN b) -> BVTermView
forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n, PEvalBitwiseTerm (bv n), Eq (bv n),
Num (bv n)) =>
Term (bv n) -> BVTermView
BVTermView Term a
Term (WordN b)
b)
(Maybe (a :~~: IntN), Maybe (a :~~: WordN))
_ -> Maybe BVTermView
forall a. Maybe a
Nothing
TypeRep a
_ -> Maybe BVTermView
forall a. Maybe a
Nothing
pattern BVTerm ::
forall a.
(SupportedPrim a) =>
forall bv n.
(KnownNat n, 1 <= n, PEvalBitwiseTerm (bv n), Eq (bv n), Num (bv n)) =>
Term (bv n) -> Term a
pattern $mBVTerm :: forall {r} {a}.
SupportedPrim a =>
Term a
-> (forall {bv :: Natural -> *} {n :: Natural}.
(KnownNat n, 1 <= n, PEvalBitwiseTerm (bv n), Eq (bv n),
Num (bv n)) =>
Term (bv n) -> r)
-> ((# #) -> r)
-> r
BVTerm x <- (bvTermViewPattern -> Just (BVTermView x))
pevalImplyTerm :: Term Bool -> Term Bool -> Term Bool
pevalImplyTerm :: Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
l Term Bool
r | Term Bool -> Term Bool -> Bool
termImplies Term Bool
l Term Bool
r = Term Bool
trueTerm
pevalImplyTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
l) Term Bool
r
pevalXorTerm :: Term Bool -> Term Bool -> Term Bool
pevalXorTerm :: Term Bool -> Term Bool -> Term Bool
pevalXorTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
l) Term Bool
r) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l (Term Bool -> Term Bool
pevalNotTerm Term Bool
r))
termImplies :: Term Bool -> Term Bool -> Bool
termImplies :: Term Bool -> Term Bool -> Bool
termImplies (ConTerm Bool
False) Term Bool
_ = Bool
True
termImplies Term Bool
_ (ConTerm Bool
True) = Bool
True
termImplies
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(DistinctTerm ((DynTerm (Term t
e2 :: Term a)) :| [(DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b))]))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
termImplies
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(NotTerm (EqTerm (DynTerm (Term t
e2 :: Term a)) ((DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))))
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
termImplies Term Bool
a (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s) | Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
a HashSet (Term Bool)
s = Bool
True
termImplies (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s) Term Bool
b | Term Bool -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => a -> HashSet a -> Bool
HS.member Term Bool
b HashSet (Term Bool)
s = Bool
True
termImplies (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s) (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) | HashSet (Term Bool) -> HashSet (Term Bool) -> HashSet (Term Bool)
forall a. Eq a => HashSet a -> HashSet a -> HashSet a
HS.intersection HashSet (Term Bool)
s HashSet (Term Bool)
s2 HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. Eq a => a -> a -> Bool
/= HashSet (Term Bool)
forall a. HashSet a
HS.empty = Bool
True
termImplies (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s) (AndTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) | HashSet (Term Bool)
s2 HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => HashSet a -> HashSet a -> Bool
`HS.isSubsetOf` HashSet (Term Bool)
s = Bool
True
termImplies (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s) (OrTermAll Term Bool
_ Term Bool
_ HashSet (Term Bool)
s2) | HashSet (Term Bool)
s HashSet (Term Bool) -> HashSet (Term Bool) -> Bool
forall a. (Eq a, Hashable a) => HashSet a -> HashSet a -> Bool
`HS.isSubsetOf` HashSet (Term Bool)
s2 = Bool
True
termImplies Term Bool
a Term Bool
b
| Term Bool
a Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
b = Bool
True
| Bool
otherwise = Bool
False
{-# INLINE termImplies #-}
pevalITEBoolLeftNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot Term Bool
cond Term Bool
nIfTrue Term Bool
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nIfTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
| Bool
otherwise = case Term Bool
nIfTrue of
AndTerm Term Bool
nt1 Term Bool
nt2 -> Maybe (Term Bool)
ra
where
ra :: Maybe (Term Bool)
ra
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond Term Bool
nt1 =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) Term Bool
ifFalse
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond Term Bool
nt2 =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) Term Bool
ifFalse
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1)
Bool -> Bool -> Bool
|| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
OrTerm Term Bool
nt1 Term Bool
nt2 -> Maybe (Term Bool)
ra
where
ra :: Maybe (Term Bool)
ra
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond Term Bool
nt1 Bool -> Bool -> Bool
|| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond Term Bool
nt2 =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) Term Bool
ifFalse
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) Term Bool
ifFalse
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolBothNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse =
Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse
pevalITEBoolRightNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot Term Bool
cond Term Bool
ifTrue Term Bool
nIfFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nIfFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifTrue
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalInferImplies :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(NotTerm (EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b))))
Term Bool
trueRes
Term Bool
_
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
trueRes
pevalInferImplies Term Bool
cond (NotTerm Term Bool
nt1) Term Bool
_ Term Bool
falseRes
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nt1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
falseRes
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalInferImplies
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(DistinctTerm ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
Term Bool
trueRes
Term Bool
_
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
trueRes
pevalInferImplies
(EqTerm (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
(EqTerm (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
Term Bool
_
Term Bool
falseRes
| Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
falseRes
pevalInferImplies Term Bool
_ Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolLeftAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
cond Term Bool
t2
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
cond Term Bool
t1
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse
| Bool
otherwise =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t1 (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse),
Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t2 (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse)
]
pevalITEBoolBothAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothAnd :: Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f2
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f1
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f2
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f1
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolRightAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
| Term Bool
f1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
f1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
f2
| Term Bool
f2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
f2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
f1
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolLeftOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
t2
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
t1
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
| Bool
otherwise =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t1 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse),
Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t2 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse)
]
pevalITEBoolBothOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothOr :: Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f2
| Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f1
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f2
| Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f1
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolRightOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
| Term Bool
f1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
f1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
f2
| Term Bool
f2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
f2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
f1
| Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft Term Bool
cond (AndTerm Term Bool
t1 Term Bool
t2) Term Bool
ifFalse =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse,
case Term Bool
ifFalse of
AndTerm Term Bool
f1 Term Bool
f2 -> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
]
pevalITEBoolLeft Term Bool
cond (OrTerm Term Bool
t1 Term Bool
t2) Term Bool
ifFalse =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse,
case Term Bool
ifFalse of
OrTerm Term Bool
f1 Term Bool
f2 -> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
]
pevalITEBoolLeft Term Bool
cond (NotTerm Term Bool
nIfTrue) Term Bool
ifFalse =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot Term Bool
cond Term Bool
nIfTrue Term Bool
ifFalse,
case Term Bool
ifFalse of
NotTerm Term Bool
nIfFalse ->
Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse
Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
]
pevalITEBoolLeft Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBoolNoLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (AndTerm Term Bool
f1 Term Bool
f2) = Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (OrTerm Term Bool
f1 Term Bool
f2) = Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (NotTerm Term Bool
nIfFalse) = Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot Term Bool
cond Term Bool
ifTrue Term Bool
nIfFalse
pevalITEBoolNoLeft Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBasic :: (SupportedPrim a) => Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic :: forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic (ConTerm Bool
True) ~Term a
ifTrue ~Term a
_ = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifTrue
pevalITEBasic (ConTerm Bool
False) ~Term a
_ ~Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifFalse
pevalITEBasic (NotTerm Term Bool
ncond) Term a
ifTrue Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
ncond Term a
ifFalse Term a
ifTrue
pevalITEBasic Term Bool
_ Term a
ifTrue Term a
ifFalse | Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifTrue
pevalITEBasic (ITETerm Term Bool
cc Term Bool
ct Term Bool
cf) (ITETerm Term Bool
tc Term a
tt Term a
tf) (ITETerm Term Bool
fc Term a
ft Term a
ff)
| Term Bool
cc Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
tc Bool -> Bool -> Bool
&& Term Bool
cc Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
fc = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cc (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
ct Term a
tt Term a
ft) (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cf Term a
tf Term a
ff)
pevalITEBasic Term Bool
cond (ITETerm Term Bool
tc Term a
tt Term a
tf) Term a
ifFalse
| Term a
tt Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
tc) Term a
tt Term a
tf
| Term a
tf Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
tc) Term a
tt Term a
tf
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
cond Term Bool
tc = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
tt Term a
ifFalse
pevalITEBasic Term Bool
cond (ITETerm (AndTerm Term Bool
c1 Term Bool
c2) Term a
tt Term a
tf) Term a
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
c1 = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
c2 Term a
tt Term a
tf) Term a
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
c2 = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
c1 Term a
tt Term a
tf) Term a
ifFalse
pevalITEBasic Term Bool
cond Term a
ifTrue (ITETerm Term Bool
fc Term a
ft Term a
ff)
| Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ft = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
fc) Term a
ifTrue Term a
ff
| Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ff = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
fc)) Term a
ifTrue Term a
ft
| Term Bool -> Term Bool -> Bool
termImplies Term Bool
fc Term Bool
cond = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
ifTrue Term a
ff
pevalITEBasic Term Bool
cond Term a
ifTrue (ITETerm (OrTerm Term Bool
c1 Term Bool
c2) Term a
ft Term a
ff)
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
c1 = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
ifTrue (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
c2 Term a
ft Term a
ff)
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
c2 = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
ifTrue (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
c1 Term a
ft Term a
ff)
pevalITEBasic Term Bool
_ Term a
_ Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
pevalITEBoolBasic :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
| Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
ifTrue
pevalITEBoolBasic Term Bool
cond (ConTerm Bool
v) Term Bool
ifFalse
| Bool
v = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
| Bool
otherwise = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue (ConTerm Bool
v)
| Bool
v = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifTrue
| Bool
otherwise = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
ifTrue
pevalITEBoolBasic Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing
pevalITEBool :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool Term Bool
cond ~Term Bool
ifTrue ~Term Bool
ifFalse =
[Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
]
pevalITEBasicTerm :: (SupportedPrim a) => Term Bool -> Term a -> Term a -> Term a
pevalITEBasicTerm :: forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm Term Bool
cond ~Term a
ifTrue ~Term a
ifFalse =
Term a -> Maybe (Term a) -> Term a
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term a -> Term a -> Term a
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term a
ifTrue Term a
ifFalse) (Maybe (Term a) -> Term a) -> Maybe (Term a) -> Term a
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term a -> Term a -> Maybe (Term a)
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term a
ifTrue Term a
ifFalse
pevalDefaultEqTerm :: (SupportedNonFuncPrim a) => Term a -> Term a -> Term Bool
pevalDefaultEqTerm :: forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm l :: Term a
l@ConTerm {} r :: Term a
r@ConTerm {} = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r
pevalDefaultEqTerm l :: Term a
l@ConTerm {} Term a
r = Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
r Term a
l
pevalDefaultEqTerm Term a
l (BoolConTerm Bool
rv) =
if Bool
rv
then Term a -> Term Bool
forall a b. a -> b
unsafeCoerce Term a
l
else Term Bool -> Term Bool
pevalNotTerm (Term a -> Term Bool
forall a b. a -> b
unsafeCoerce Term a
l)
pevalDefaultEqTerm (NotTerm Term Bool
lv) Term a
r
| Term Bool
lv Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
Term Bool
r = Term Bool
falseTerm
pevalDefaultEqTerm Term a
l (NotTerm Term Bool
rv)
| Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
Term Bool
rv = Term Bool
falseTerm
pevalDefaultEqTerm (AddNumTerm (ConTerm a
c) Term a
v) (ConTerm a
c2) =
Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
v (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
c2 a -> a -> a
forall a. Num a => a -> a -> a
- a
c)
pevalDefaultEqTerm Term a
l (ITETerm Term Bool
c Term a
t Term a
f)
| Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
t = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
c (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
l Term a
f)
| Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
f = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
c) (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
l Term a
t)
pevalDefaultEqTerm (ITETerm Term Bool
c Term a
t Term a
f) Term a
r
| Term a
t Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
c (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
f Term a
r)
| Term a
f Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
c) (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
t Term a
r)
pevalDefaultEqTerm Term a
l Term a
r
| Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool
trueTerm
| Bool
otherwise = Term a -> Term a -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term a
l Term a
r
{-# INLINEABLE pevalDefaultEqTerm #-}
instance SBVRep Bool where
type SBVType Bool = SBV.SBV Bool
instance SupportedPrimConstraint Bool
instance SupportedPrim Bool where
pformatCon :: Bool -> String
pformatCon Bool
True = String
"true"
pformatCon Bool
False = String
"false"
defaultValue :: Bool
defaultValue = Bool
defaultValueForBool
pevalITETerm :: Term Bool -> Term Bool -> Term Bool -> Term Bool
pevalITETerm Term Bool
cond ~Term Bool
ifTrue ~Term Bool
ifFalse =
Term Bool -> Maybe (Term Bool) -> Term Bool
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse) (Maybe (Term Bool) -> Term Bool) -> Maybe (Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
pevalEqTerm :: Term Bool -> Term Bool -> Term Bool
pevalEqTerm (EqTerm (DynTerm (Term Bool
l1 :: Term Bool)) Term t
l2) (EqTerm Term t
r1 Term t
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term Bool
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2)
| Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term Bool
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1)
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term Bool -> Term t
forall a b. a -> b
unsafeCoerce Term Bool
l1) Term t
r2
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term Bool -> Term t
forall a b. a -> b
unsafeCoerce Term Bool
l1) Term t
r1
pevalEqTerm (EqTerm (DynTerm (Term (WordN 1)
l1 :: Term (WordN 1))) Term t
l2) (EqTerm Term t
r1 Term t
r2)
| Term (WordN 1)
l1 Term (WordN 1) -> Term (WordN 1) -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term (WordN 1)
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2)
| Term (WordN 1)
l1 Term (WordN 1) -> Term (WordN 1) -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term (WordN 1)
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1)
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term (WordN 1) -> Term t
forall a b. a -> b
unsafeCoerce Term (WordN 1)
l1) Term t
r2
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term (WordN 1) -> Term t
forall a b. a -> b
unsafeCoerce Term (WordN 1)
l1) Term t
r1
pevalEqTerm (EqTerm (DynTerm (Term (IntN 1)
l1 :: Term (IntN 1))) Term t
l2) (EqTerm Term t
r1 Term t
r2)
| Term (IntN 1)
l1 Term (IntN 1) -> Term (IntN 1) -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term (IntN 1)
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2)
| Term (IntN 1)
l1 Term (IntN 1) -> Term (IntN 1) -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term (IntN 1)
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
l2 (Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1)
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r1 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term (IntN 1) -> Term t
forall a b. a -> b
unsafeCoerce Term (IntN 1)
l1) Term t
r2
| Term t
l2 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Term t
forall a b. a -> b
unsafeCoerce Term t
r2 = Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm (Term (IntN 1) -> Term t
forall a b. a -> b
unsafeCoerce Term (IntN 1)
l1) Term t
r1
pevalEqTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term Bool
l Term Bool
r
pevalDistinctTerm :: NonEmpty (Term Bool) -> Term Bool
pevalDistinctTerm (Term Bool
_ :| []) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
pevalDistinctTerm (Term Bool
a :| [Term Bool
b]) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term Bool
a Term Bool
b
pevalDistinctTerm NonEmpty (Term Bool)
_ = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
False
conSBVTerm :: Bool -> SBVType Bool
conSBVTerm Bool
n = if Bool
n then SBV Bool
SBVType Bool
SBV.sTrue else SBV Bool
SBVType Bool
SBV.sFalse
symSBVName :: TypedSymbol 'AnyKind Bool -> Int -> String
symSBVName TypedSymbol 'AnyKind Bool
symbol Int
_ = TypedSymbol 'AnyKind Bool -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind Bool
symbol
symSBVTerm :: forall (m :: * -> *). SBVFreshMonad m => String -> m (SBVType Bool)
symSBVTerm = String -> m (SBV Bool)
String -> m (SBVType Bool)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
withPrim :: forall a.
((PrimConstraint Bool, SMTDefinable (SBVType Bool),
Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
a)
-> a
withPrim (PrimConstraint Bool, SMTDefinable (SBVType Bool),
Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
a
r = a
(PrimConstraint Bool, SMTDefinable (SBVType Bool),
Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
a
r
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> Bool
parseSMTModelResult Int
_ = (Bool -> Bool) -> ([([CV], CV)], CV) -> Bool
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult Bool -> Bool
forall a. a -> a
id
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd Bool ->
Maybe (TypedSymbol knd' Bool)
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd Bool -> Maybe (TypedSymbol knd' Bool)
castTypedSymbol (TypedSymbol Symbol
s) =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a. a -> Maybe a
Just (TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool))
-> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol knd' Bool
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a. a -> Maybe a
Just (TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool))
-> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol knd' Bool
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
funcDummyConstraint :: SBVType Bool -> SBV Bool
funcDummyConstraint SBVType Bool
_ = SBV Bool
SBV.sTrue
instance NonFuncSBVRep Bool where
type NonFuncSBVBaseType Bool = Bool
instance SupportedNonFuncPrim Bool where
conNonFuncSBVTerm :: Bool -> SBV (NonFuncSBVBaseType Bool)
conNonFuncSBVTerm = Bool -> SBV (NonFuncSBVBaseType Bool)
Bool -> SBVType Bool
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType Bool))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @Bool
withNonFuncPrim :: forall r. (NonFuncPrimConstraint Bool => r) -> r
withNonFuncPrim NonFuncPrimConstraint Bool => r
r = r
NonFuncPrimConstraint Bool => r
r
data PhantomDict a where
PhantomDict :: (SupportedPrim a) => PhantomDict a
data PhantomNonFuncDict a where
PhantomNonFuncDict ::
(SupportedNonFuncPrim a) => PhantomNonFuncDict a
{-# NOINLINE phantomDictCache #-}
phantomDictCache :: IORef (HM.HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache :: IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache = IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomDict Any))
forall a. IO a -> a
unsafePerformIO (IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomDict Any))
forall a b. (a -> b) -> a -> b
$ HashMap SomeTypeRep (PhantomDict Any)
-> IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
forall a. a -> IO (IORef a)
newIORef HashMap SomeTypeRep (PhantomDict Any)
forall k v. HashMap k v
HM.empty
{-# NOINLINE getPhantomDict #-}
getPhantomDict :: forall a. (SupportedPrim a) => PhantomDict a
getPhantomDict :: forall a. SupportedPrim a => PhantomDict a
getPhantomDict = IO (PhantomDict a) -> PhantomDict a
forall a. IO a -> a
unsafePerformIO (IO (PhantomDict a) -> PhantomDict a)
-> IO (PhantomDict a) -> PhantomDict a
forall a b. (a -> b) -> a -> b
$ do
cache <- IORef (HashMap SomeTypeRep (PhantomDict Any))
-> IO (HashMap SomeTypeRep (PhantomDict Any))
forall a. IORef a -> IO a
readIORef IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache
let !tr = TypeRep a -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep a -> SomeTypeRep) -> TypeRep a -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @a
case HM.lookup tr cache of
Just PhantomDict Any
p -> PhantomDict a -> IO (PhantomDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (PhantomDict a -> IO (PhantomDict a))
-> PhantomDict a -> IO (PhantomDict a)
forall a b. (a -> b) -> a -> b
$ PhantomDict Any -> PhantomDict a
forall a b. a -> b
unsafeCoerce PhantomDict Any
p
Maybe (PhantomDict Any)
Nothing -> do
let r :: PhantomDict a
r = PhantomDict a
forall a. SupportedPrim a => PhantomDict a
PhantomDict :: PhantomDict a
IORef (HashMap SomeTypeRep (PhantomDict Any))
-> (HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any))
-> IO ()
forall t. IORef t -> (t -> t) -> IO ()
atomicModifyIORefCAS_ IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache ((HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any))
-> IO ())
-> (HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any))
-> IO ()
forall a b. (a -> b) -> a -> b
$ SomeTypeRep
-> PhantomDict Any
-> HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any)
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
HM.insert SomeTypeRep
tr (PhantomDict Any
-> HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any))
-> PhantomDict Any
-> HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any)
forall a b. (a -> b) -> a -> b
$ PhantomDict a -> PhantomDict Any
forall a b. a -> b
unsafeCoerce PhantomDict a
r
PhantomDict a -> IO (PhantomDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PhantomDict a
r
{-# NOINLINE phantomNonFuncDictCache #-}
phantomNonFuncDictCache ::
IORef (HM.HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache :: IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache = IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a. IO a -> a
unsafePerformIO (IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a b. (a -> b) -> a -> b
$ HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
forall a. a -> IO (IORef a)
newIORef HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall k v. HashMap k v
HM.empty
{-# NOINLINE getPhantomNonFuncDict #-}
getPhantomNonFuncDict ::
forall a. (SupportedNonFuncPrim a) => PhantomNonFuncDict a
getPhantomNonFuncDict :: forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
getPhantomNonFuncDict = IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a
forall a. IO a -> a
unsafePerformIO (IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a)
-> IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a
forall a b. (a -> b) -> a -> b
$ do
cache <- IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a. IORef a -> IO a
readIORef IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache
let !tr = TypeRep a -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep a -> SomeTypeRep) -> TypeRep a -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @a
case HM.lookup tr cache of
Just PhantomNonFuncDict Any
p -> PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (PhantomNonFuncDict a -> IO (PhantomNonFuncDict a))
-> PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a b. (a -> b) -> a -> b
$ PhantomNonFuncDict Any -> PhantomNonFuncDict a
forall a b. a -> b
unsafeCoerce PhantomNonFuncDict Any
p
Maybe (PhantomNonFuncDict Any)
Nothing -> do
let r :: PhantomNonFuncDict a
r = PhantomNonFuncDict a
forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
PhantomNonFuncDict :: PhantomNonFuncDict a
IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> (HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO ()
forall t. IORef t -> (t -> t) -> IO ()
atomicModifyIORefCAS_ IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache ((HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO ())
-> (HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO ()
forall a b. (a -> b) -> a -> b
$
SomeTypeRep
-> PhantomNonFuncDict Any
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
HM.insert SomeTypeRep
tr (PhantomNonFuncDict Any
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> PhantomNonFuncDict Any
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall a b. (a -> b) -> a -> b
$
PhantomNonFuncDict a -> PhantomNonFuncDict Any
forall a b. a -> b
unsafeCoerce PhantomNonFuncDict a
r
PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PhantomNonFuncDict a
r
defaultValueForInteger :: Integer
defaultValueForInteger :: Integer
defaultValueForInteger = Integer
0
instance SBVRep Integer where
type SBVType Integer = SBV.SBV Integer
instance SupportedPrimConstraint Integer where
type PrimConstraint Integer = (Integral (NonFuncSBVBaseType Integer))
pairwiseHasConcreteEqual :: (SupportedNonFuncPrim a) => [Term a] -> Bool
pairwiseHasConcreteEqual :: forall a. SupportedNonFuncPrim a => [Term a] -> Bool
pairwiseHasConcreteEqual [] = Bool
False
pairwiseHasConcreteEqual [Term a
_] = Bool
False
pairwiseHasConcreteEqual (Term a
x : [Term a]
xs) =
Term a -> [Term a] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
go Term a
x [Term a]
xs Bool -> Bool -> Bool
|| [Term a] -> Bool
forall a. SupportedNonFuncPrim a => [Term a] -> Bool
pairwiseHasConcreteEqual [Term a]
xs
where
go :: t -> [t] -> Bool
go t
_ [] = Bool
False
go t
x (t
y : [t]
ys) = t
x t -> t -> Bool
forall a. Eq a => a -> a -> Bool
== t
y Bool -> Bool -> Bool
|| t -> [t] -> Bool
go t
x [t]
ys
getAllConcrete :: [Term a] -> Maybe [a]
getAllConcrete :: forall a. [Term a] -> Maybe [a]
getAllConcrete [] = [a] -> Maybe [a]
forall a. a -> Maybe a
forall (m :: * -> *) a. Monad m => a -> m a
return []
getAllConcrete (ConTerm a
x : [Term a]
xs) = (a
x a -> [a] -> [a]
forall a. a -> [a] -> [a]
:) ([a] -> [a]) -> Maybe [a] -> Maybe [a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Term a] -> Maybe [a]
forall a. [Term a] -> Maybe [a]
getAllConcrete [Term a]
xs
getAllConcrete [Term a]
_ = Maybe [a]
forall a. Maybe a
Nothing
checkConcreteDistinct :: (Eq t) => [t] -> Bool
checkConcreteDistinct :: forall t. Eq t => [t] -> Bool
checkConcreteDistinct [] = Bool
True
checkConcreteDistinct (t
x : [t]
xs) = t -> [t] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
check0 t
x [t]
xs Bool -> Bool -> Bool
&& [t] -> Bool
forall t. Eq t => [t] -> Bool
checkConcreteDistinct [t]
xs
where
check0 :: t -> [t] -> Bool
check0 t
_ [] = Bool
True
check0 t
x (t
y : [t]
ys) = t
x t -> t -> Bool
forall a. Eq a => a -> a -> Bool
/= t
y Bool -> Bool -> Bool
&& t -> [t] -> Bool
check0 t
x [t]
ys
pevalGeneralDistinct ::
(SupportedNonFuncPrim a) => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct :: forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct (Term a
_ :| []) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
pevalGeneralDistinct (Term a
a :| [Term a
b]) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term a
a Term a
b
pevalGeneralDistinct NonEmpty (Term a)
l | [Term a] -> Bool
forall a. SupportedNonFuncPrim a => [Term a] -> Bool
pairwiseHasConcreteEqual ([Term a] -> Bool) -> [Term a] -> Bool
forall a b. (a -> b) -> a -> b
$ NonEmpty (Term a) -> [Term a]
forall a. NonEmpty a -> [a]
toList NonEmpty (Term a)
l = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
False
pevalGeneralDistinct NonEmpty (Term a)
l =
case [Term a] -> Maybe [a]
forall a. [Term a] -> Maybe [a]
getAllConcrete (NonEmpty (Term a) -> [Term a]
forall a. NonEmpty a -> [a]
toList NonEmpty (Term a)
l) of
Maybe [a]
Nothing -> NonEmpty (Term a) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term a)
l
Just [a]
xs -> Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ [a] -> Bool
forall t. Eq t => [t] -> Bool
checkConcreteDistinct [a]
xs
instance SupportedPrim Integer where
pformatCon :: Integer -> String
pformatCon = Integer -> String
forall a. Show a => a -> String
show
defaultValue :: Integer
defaultValue = Integer
defaultValueForInteger
pevalITETerm :: Term Bool -> Term Integer -> Term Integer -> Term Integer
pevalITETerm = Term Bool -> Term Integer -> Term Integer -> Term Integer
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm
pevalEqTerm :: Term Integer -> Term Integer -> Term Bool
pevalEqTerm = Term Integer -> Term Integer -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm
pevalDistinctTerm :: NonEmpty (Term Integer) -> Term Bool
pevalDistinctTerm = NonEmpty (Term Integer) -> Term Bool
forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct
conSBVTerm :: Integer -> SBVType Integer
conSBVTerm Integer
n = Integer -> SBV Integer
forall a. Num a => Integer -> a
fromInteger Integer
n
symSBVName :: TypedSymbol 'AnyKind Integer -> Int -> String
symSBVName TypedSymbol 'AnyKind Integer
symbol Int
_ = TypedSymbol 'AnyKind Integer -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind Integer
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType Integer)
symSBVTerm String
name = String -> m (SBV Integer)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> Integer
parseSMTModelResult Int
_ = (Integer -> Integer) -> ([([CV], CV)], CV) -> Integer
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult Integer -> Integer
forall a. a -> a
id
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd Integer ->
Maybe (TypedSymbol knd' Integer)
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd Integer -> Maybe (TypedSymbol knd' Integer)
castTypedSymbol TypedSymbol knd Integer
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer)
forall a. a -> Maybe a
Just (TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer))
-> TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind Integer
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind Integer)
-> Symbol -> TypedSymbol 'ConstantKind Integer
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd Integer -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd Integer
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer)
forall a. a -> Maybe a
Just (TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer))
-> TypedSymbol knd' Integer -> Maybe (TypedSymbol knd' Integer)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind Integer
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind Integer)
-> Symbol -> TypedSymbol 'AnyKind Integer
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd Integer -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd Integer
s
funcDummyConstraint :: SBVType Integer -> SBV Bool
funcDummyConstraint SBVType Integer
_ = SBV Bool
SBV.sTrue
instance NonFuncSBVRep Integer where
type NonFuncSBVBaseType Integer = Integer
instance SupportedNonFuncPrim Integer where
conNonFuncSBVTerm :: Integer -> SBV (NonFuncSBVBaseType Integer)
conNonFuncSBVTerm = Integer -> SBV (NonFuncSBVBaseType Integer)
Integer -> SBVType Integer
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType Integer))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @Integer
withNonFuncPrim :: forall r. (NonFuncPrimConstraint Integer => r) -> r
withNonFuncPrim NonFuncPrimConstraint Integer => r
r = r
NonFuncPrimConstraint Integer => r
r
pevalITEBVTerm ::
forall bv n.
( KnownNat n,
1 <= n,
forall m. (KnownNat m, 1 <= m) => SupportedPrim (bv m),
forall m. (KnownNat m, 1 <= m) => Show (bv m),
PEvalBVTerm bv
) =>
Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
pevalITEBVTerm :: forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m),
forall (m :: Natural). (KnownNat m, 1 <= m) => Show (bv m),
PEvalBVTerm bv) =>
Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
pevalITEBVTerm
( EqTerm
(DynTerm (Term (bv n)
l :: Term (bv n)))
(DynTerm (ConTerm (bv n
r :: bv n)))
)
(ConTerm bv n
t)
(ConTerm bv n
f)
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
r bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 Bool -> Bool -> Bool
&& bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
f bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv n)
l
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
r bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 Bool -> Bool -> Bool
&& bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 Bool -> Bool -> Bool
&& bv n
f bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just Term (bv n)
l
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
r bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
f bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just Term (bv n)
l
| Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1 Bool -> Bool -> Bool
&& bv n
r bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
&& bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
1 Bool -> Bool -> Bool
&& bv n
f bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv n)
l
pevalITEBVTerm
(EqTerm (DynTerm (Term (bv 1)
l :: Term (bv 1))) (DynTerm (ConTerm (bv 1
r :: bv 1))))
(ConTerm bv n
t)
Term (bv n)
f
| Natural
n Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
> Natural
1 Bool -> Bool -> Bool
&& (bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 Bool -> Bool -> Bool
|| bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== -bv n
1) Bool -> Bool -> Bool
&& (bv 1
r bv 1 -> bv 1 -> Bool
forall a. Eq a => a -> a -> Bool
== -bv 1
1 Bool -> Bool -> Bool
|| bv 1
r bv 1 -> bv 1 -> Bool
forall a. Eq a => a -> a -> Bool
== bv 1
0) =
Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$
(if bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0 then Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm else Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm)
( NatRepr 1 -> NatRepr n -> Bool -> Term (bv 1) -> Term (bv n)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
PEvalBVTerm bv =>
NatRepr l -> NatRepr r -> Bool -> Term (bv l) -> Term (bv r)
unsafePevalBVExtendTerm
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @1)
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n)
Bool
True
(if (bv 1
r bv 1 -> bv 1 -> Bool
forall a. Eq a => a -> a -> Bool
== bv 1
0) Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== (bv n
t bv n -> bv n -> Bool
forall a. Eq a => a -> a -> Bool
== bv n
0) then Term (bv 1)
l else Term (bv 1) -> Term (bv 1)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv 1)
l)
)
Term (bv n)
f
where
n :: Natural
n = Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n)
pevalITEBVTerm
(EqTerm (DynTerm (Term (bv 1)
_ :: Term (bv 1))) (DynTerm (ConTerm (bv 1
_ :: bv 1))))
(ConTerm bv n
_)
(ConTerm bv n
_) = Maybe (Term (bv n))
forall a. Maybe a
Nothing
pevalITEBVTerm
(EqTerm (DynTerm (Term (bv 1)
l :: Term (bv 1))) (DynTerm (ConTerm (bv 1
r :: bv 1))))
Term (bv n)
t
f :: Term (bv n)
f@(ConTerm bv n
_) = Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m),
forall (m :: Natural). (KnownNat m, 1 <= m) => Show (bv m),
PEvalBVTerm bv) =>
Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
pevalITEBVTerm (Term (bv 1) -> Term (bv 1) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term (bv 1)
l (bv 1 -> Term (bv 1)
forall t. SupportedPrim t => t -> Term t
conTerm (bv 1 -> Term (bv 1)) -> bv 1 -> Term (bv 1)
forall a b. (a -> b) -> a -> b
$ bv 1 -> bv 1
forall a. Bits a => a -> a
complement bv 1
r)) Term (bv n)
f Term (bv n)
t
pevalITEBVTerm
Term Bool
cond
(BVConcatTerm (Term (bv l)
a :: Term (bv a)) (Term (bv r)
b :: Term (bv b)))
(BVConcatTerm (DynTerm (Term (bv l)
c :: Term (bv a))) Term (bv r)
d) =
Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(Term Bool -> Term (bv l) -> Term (bv l) -> Term (bv l)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv l)
a Term (bv l)
c)
(Term Bool -> Term (bv r) -> Term (bv r) -> Term (bv r)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv r)
b (Term (bv r) -> Term (bv r)
forall a b. a -> b
unsafeCoerce Term (bv r)
d))
pevalITEBVTerm
Term Bool
cond
(BVExtendTerm Bool
True Proxy r
pl (Term (bv l)
a :: Term (bv a)))
(BVExtendTerm Bool
True Proxy r
_ (DynTerm (Term (bv l)
b :: Term (bv a)))) =
Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$
Bool -> Proxy n -> Term (bv l) -> Term (bv n)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm
Bool
True
Proxy n
Proxy r
pl
(Term Bool -> Term (bv l) -> Term (bv l) -> Term (bv l)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv l)
a Term (bv l)
b)
pevalITEBVTerm Term Bool
cond (AndBitsTerm Term (bv n)
a Term (bv n)
b) (AndBitsTerm Term (bv n)
c Term (bv n)
d)
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
b Term (bv n)
d
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
d = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
b Term (bv n)
c
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
b (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
a Term (bv n)
d
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
d = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
b (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
a Term (bv n)
c
pevalITEBVTerm Term Bool
cond (AndBitsTerm Term (bv n)
a Term (bv n)
b) Term (bv n)
c
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
c (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm (Term Bool -> Term (bv n)) -> Term Bool -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term (bv n)
b
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
c (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm (Term Bool -> Term (bv n)) -> Term Bool -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term (bv n)
a
pevalITEBVTerm Term Bool
cond Term (bv n)
a (AndBitsTerm Term (bv n)
b Term (bv n)
c)
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
b = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm Term Bool
cond) Term (bv n)
c
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm Term Bool
cond) Term (bv n)
b
pevalITEBVTerm Term Bool
cond (OrBitsTerm Term (bv n)
a Term (bv n)
b) (OrBitsTerm Term (bv n)
c Term (bv n)
d)
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
b Term (bv n)
d
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
d = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
b Term (bv n)
c
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
b (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
a Term (bv n)
d
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
d = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
b (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv n) -> Term (bv n) -> Term (bv n)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv n)
a Term (bv n)
c
pevalITEBVTerm Term Bool
cond (OrBitsTerm Term (bv n)
a Term (bv n)
b) Term (bv n)
c
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
c (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm Term Bool
cond) Term (bv n)
b
| Term (bv n)
b Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
c (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm Term Bool
cond) Term (bv n)
a
pevalITEBVTerm Term Bool
cond Term (bv n)
a (OrBitsTerm Term (bv n)
b Term (bv n)
c)
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
b = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm (Term Bool -> Term (bv n)) -> Term Bool -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term (bv n)
c
| Term (bv n)
a Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
c = Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just (Term (bv n) -> Maybe (Term (bv n)))
-> Term (bv n) -> Maybe (Term (bv n))
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm Term (bv n)
a (Term (bv n) -> Term (bv n)) -> Term (bv n) -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term (bv n) -> Term (bv n) -> Term (bv n)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Term Bool -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm (Term Bool -> Term (bv n)) -> Term Bool -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term (bv n)
b
pevalITEBVTerm Term Bool
_ Term (bv n)
_ Term (bv n)
_ = Maybe (Term (bv n))
forall a. Maybe a
Nothing
boolToBVTerm ::
forall bv n.
( PEvalBVTerm bv,
KnownNat n,
1 <= n,
forall m. (KnownNat m, 1 <= m) => SupportedPrim (bv m)
) =>
Term Bool -> Term (bv n)
boolToBVTerm :: forall (bv :: Natural -> *) (n :: Natural).
(PEvalBVTerm bv, KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m)) =>
Term Bool -> Term (bv n)
boolToBVTerm Term Bool
cond =
let bv :: Term (bv 1)
bv =
case Term Bool
cond of
NotTerm Term Bool
c -> Term Bool -> Term (bv 1) -> Term (bv 1) -> Term (bv 1)
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
c (bv 1 -> Term (bv 1)
forall t. SupportedPrim t => t -> Term t
conTerm bv 1
0) (bv 1 -> Term (bv 1)
forall t. SupportedPrim t => t -> Term t
conTerm bv 1
1)
Term Bool
_ -> Term Bool -> Term (bv 1) -> Term (bv 1) -> Term (bv 1)
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond (bv 1 -> Term (bv 1)
forall t. SupportedPrim t => t -> Term t
conTerm bv 1
1 :: Term (bv 1)) (bv 1 -> Term (bv 1)
forall t. SupportedPrim t => t -> Term t
conTerm bv 1
0) :: Term (bv 1)
in if Proxy n -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
1
then Term (bv 1) -> Term (bv n)
forall a b. a -> b
unsafeCoerce Term (bv 1)
bv
else Bool -> NatRepr n -> Term (bv 1) -> Term (bv n)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
True (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n) Term (bv 1)
bv
instance (KnownNat w, 1 <= w) => SupportedPrimConstraint (IntN w) where
type PrimConstraint (IntN w) = (KnownNat w, 1 <= w, BVIsNonZero w)
instance (KnownNat w, 1 <= w) => SBVRep (IntN w) where
type SBVType (IntN w) = SBV.SBV (SBV.IntN w)
instance (KnownNat w, 1 <= w) => SupportedPrim (IntN w) where
sbvDistinct :: NonEmpty (SBVType (IntN w)) -> SBV Bool
sbvDistinct = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(IntN w) (((PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
NonEmpty (SBVType (IntN w)) -> SBV Bool)
-> NonEmpty (SBVType (IntN w)) -> SBV Bool)
-> ((PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
NonEmpty (SBVType (IntN w)) -> SBV Bool)
-> NonEmpty (SBVType (IntN w))
-> SBV Bool
forall a b. (a -> b) -> a -> b
$ [SBV (IntN w)] -> SBV Bool
forall a. EqSymbolic a => [a] -> SBV Bool
SBV.distinct ([SBV (IntN w)] -> SBV Bool)
-> (NonEmpty (SBV (IntN w)) -> [SBV (IntN w)])
-> NonEmpty (SBV (IntN w))
-> SBV Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (SBV (IntN w)) -> [SBV (IntN w)]
forall a. NonEmpty a -> [a]
toList
sbvEq :: SBVType (IntN w) -> SBVType (IntN w) -> SBV Bool
sbvEq = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(IntN w) SBV (IntN w) -> SBV (IntN w) -> SBV Bool
(PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
SBV (IntN w) -> SBV (IntN w) -> SBV Bool
forall a. EqSymbolic a => a -> a -> SBV Bool
(SBV..==)
pformatCon :: IntN w -> String
pformatCon = IntN w -> String
forall a. Show a => a -> String
show
defaultValue :: IntN w
defaultValue = IntN w
0
pevalITETerm :: Term Bool -> Term (IntN w) -> Term (IntN w) -> Term (IntN w)
pevalITETerm Term Bool
cond Term (IntN w)
ifTrue Term (IntN w)
ifFalse =
Term (IntN w) -> Maybe (Term (IntN w)) -> Term (IntN w)
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term (IntN w) -> Term (IntN w) -> Term (IntN w)
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term (IntN w)
ifTrue Term (IntN w)
ifFalse) (Maybe (Term (IntN w)) -> Term (IntN w))
-> Maybe (Term (IntN w)) -> Term (IntN w)
forall a b. (a -> b) -> a -> b
$
[Maybe (Term (IntN w))] -> Maybe (Term (IntN w))
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term (IntN w) -> Term (IntN w) -> Maybe (Term (IntN w))
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term (IntN w)
ifTrue Term (IntN w)
ifFalse,
Term Bool
-> Term (IntN w) -> Term (IntN w) -> Maybe (Term (IntN w))
forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m),
forall (m :: Natural). (KnownNat m, 1 <= m) => Show (bv m),
PEvalBVTerm bv) =>
Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
pevalITEBVTerm Term Bool
cond Term (IntN w)
ifTrue Term (IntN w)
ifFalse
]
pevalEqTerm :: Term (IntN w) -> Term (IntN w) -> Term Bool
pevalEqTerm = Term (IntN w) -> Term (IntN w) -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm
pevalDistinctTerm :: NonEmpty (Term (IntN w)) -> Term Bool
pevalDistinctTerm = NonEmpty (Term (IntN w)) -> Term Bool
forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct
conSBVTerm :: IntN w -> SBVType (IntN w)
conSBVTerm IntN w
n = Proxy w -> (BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w))
-> (BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w)
forall a b. (a -> b) -> a -> b
$ IntN w -> SBV (IntN w)
forall a b. (Integral a, Num b) => a -> b
fromIntegral IntN w
n
symSBVName :: TypedSymbol 'AnyKind (IntN w) -> Int -> String
symSBVName TypedSymbol 'AnyKind (IntN w)
symbol Int
_ = TypedSymbol 'AnyKind (IntN w) -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind (IntN w)
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType (IntN w))
symSBVTerm String
name = Proxy w
-> (BVIsNonZero w => m (SBVType (IntN w))) -> m (SBVType (IntN w))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => m (SBVType (IntN w))) -> m (SBVType (IntN w)))
-> (BVIsNonZero w => m (SBVType (IntN w))) -> m (SBVType (IntN w))
forall a b. (a -> b) -> a -> b
$ String -> m (SBV (IntN w))
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
withPrim :: forall a.
((PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
a)
-> a
withPrim (PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
a
r = Proxy w -> (BVIsNonZero w => a) -> a
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) a
BVIsNonZero w => a
(PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
a
r
{-# INLINE withPrim #-}
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> IntN w
parseSMTModelResult Int
_ ([([CV], CV)], CV)
cv =
forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(IntN w) (((PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
IntN w)
-> IntN w)
-> ((PrimConstraint (IntN w), SMTDefinable (SBVType (IntN w)),
Mergeable (SBVType (IntN w)), Typeable (SBVType (IntN w))) =>
IntN w)
-> IntN w
forall a b. (a -> b) -> a -> b
$
(IntN w -> IntN w) -> ([([CV], CV)], CV) -> IntN w
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult (\(IntN w
x :: SBV.IntN w) -> IntN w -> IntN w
forall a b. (Integral a, Num b) => a -> b
fromIntegral IntN w
x) ([([CV], CV)], CV)
cv
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd (IntN w) ->
Maybe (TypedSymbol knd' (IntN w))
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd (IntN w) -> Maybe (TypedSymbol knd' (IntN w))
castTypedSymbol TypedSymbol knd (IntN w)
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w))
forall a. a -> Maybe a
Just (TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w)))
-> TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind (IntN w)
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind (IntN w))
-> Symbol -> TypedSymbol 'ConstantKind (IntN w)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (IntN w) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (IntN w)
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w))
forall a. a -> Maybe a
Just (TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w)))
-> TypedSymbol knd' (IntN w) -> Maybe (TypedSymbol knd' (IntN w))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind (IntN w)
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind (IntN w))
-> Symbol -> TypedSymbol 'AnyKind (IntN w)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (IntN w) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (IntN w)
s
funcDummyConstraint :: SBVType (IntN w) -> SBV Bool
funcDummyConstraint SBVType (IntN w)
_ = SBV Bool
SBV.sTrue
bvIsNonZeroFromGEq1 ::
forall w r proxy.
(1 <= w) =>
proxy w ->
((SBV.BVIsNonZero w) => r) ->
r
bvIsNonZeroFromGEq1 :: forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 proxy w
_ BVIsNonZero w => r
r1 = case w :~: 1
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom :: w :~: 1 of
w :~: 1
Refl -> r
BVIsNonZero w => r
r1
{-# INLINE bvIsNonZeroFromGEq1 #-}
instance (KnownNat w, 1 <= w) => NonFuncSBVRep (IntN w) where
type NonFuncSBVBaseType (IntN w) = SBV.IntN w
instance (KnownNat w, 1 <= w) => SupportedNonFuncPrim (IntN w) where
conNonFuncSBVTerm :: IntN w -> SBV (NonFuncSBVBaseType (IntN w))
conNonFuncSBVTerm = IntN w -> SBV (NonFuncSBVBaseType (IntN w))
IntN w -> SBVType (IntN w)
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType (IntN w)))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @(IntN w)
withNonFuncPrim :: forall r. (NonFuncPrimConstraint (IntN w) => r) -> r
withNonFuncPrim NonFuncPrimConstraint (IntN w) => r
r = Proxy w -> (BVIsNonZero w => r) -> r
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) r
NonFuncPrimConstraint (IntN w) => r
BVIsNonZero w => r
r
instance (KnownNat w, 1 <= w) => SupportedPrimConstraint (WordN w) where
type PrimConstraint (WordN w) = (KnownNat w, 1 <= w, BVIsNonZero w)
instance (KnownNat w, 1 <= w) => SBVRep (WordN w) where
type SBVType (WordN w) = SBV.SBV (SBV.WordN w)
instance (KnownNat w, 1 <= w) => SupportedPrim (WordN w) where
sbvDistinct :: NonEmpty (SBVType (WordN w)) -> SBV Bool
sbvDistinct = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(WordN w) (((PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
NonEmpty (SBVType (WordN w)) -> SBV Bool)
-> NonEmpty (SBVType (WordN w)) -> SBV Bool)
-> ((PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
NonEmpty (SBVType (WordN w)) -> SBV Bool)
-> NonEmpty (SBVType (WordN w))
-> SBV Bool
forall a b. (a -> b) -> a -> b
$ [SBV (WordN w)] -> SBV Bool
forall a. EqSymbolic a => [a] -> SBV Bool
SBV.distinct ([SBV (WordN w)] -> SBV Bool)
-> (NonEmpty (SBV (WordN w)) -> [SBV (WordN w)])
-> NonEmpty (SBV (WordN w))
-> SBV Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (SBV (WordN w)) -> [SBV (WordN w)]
forall a. NonEmpty a -> [a]
toList
sbvEq :: SBVType (WordN w) -> SBVType (WordN w) -> SBV Bool
sbvEq = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(WordN w) SBV (WordN w) -> SBV (WordN w) -> SBV Bool
(PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
SBV (WordN w) -> SBV (WordN w) -> SBV Bool
forall a. EqSymbolic a => a -> a -> SBV Bool
(SBV..==)
pformatCon :: WordN w -> String
pformatCon = WordN w -> String
forall a. Show a => a -> String
show
defaultValue :: WordN w
defaultValue = WordN w
0
pevalITETerm :: Term Bool -> Term (WordN w) -> Term (WordN w) -> Term (WordN w)
pevalITETerm Term Bool
cond Term (WordN w)
ifTrue Term (WordN w)
ifFalse =
Term (WordN w) -> Maybe (Term (WordN w)) -> Term (WordN w)
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term (WordN w) -> Term (WordN w) -> Term (WordN w)
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term (WordN w)
ifTrue Term (WordN w)
ifFalse) (Maybe (Term (WordN w)) -> Term (WordN w))
-> Maybe (Term (WordN w)) -> Term (WordN w)
forall a b. (a -> b) -> a -> b
$
[Maybe (Term (WordN w))] -> Maybe (Term (WordN w))
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term Bool
-> Term (WordN w) -> Term (WordN w) -> Maybe (Term (WordN w))
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term (WordN w)
ifTrue Term (WordN w)
ifFalse,
Term Bool
-> Term (WordN w) -> Term (WordN w) -> Maybe (Term (WordN w))
forall (bv :: Natural -> *) (n :: Natural).
(KnownNat n, 1 <= n,
forall (m :: Natural).
(KnownNat m, 1 <= m) =>
SupportedPrim (bv m),
forall (m :: Natural). (KnownNat m, 1 <= m) => Show (bv m),
PEvalBVTerm bv) =>
Term Bool -> Term (bv n) -> Term (bv n) -> Maybe (Term (bv n))
pevalITEBVTerm Term Bool
cond Term (WordN w)
ifTrue Term (WordN w)
ifFalse
]
pevalEqTerm :: Term (WordN w) -> Term (WordN w) -> Term Bool
pevalEqTerm = Term (WordN w) -> Term (WordN w) -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm
pevalDistinctTerm :: NonEmpty (Term (WordN w)) -> Term Bool
pevalDistinctTerm = NonEmpty (Term (WordN w)) -> Term Bool
forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct
conSBVTerm :: WordN w -> SBVType (WordN w)
conSBVTerm WordN w
n = Proxy w
-> (BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w))
-> (BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w)
forall a b. (a -> b) -> a -> b
$ WordN w -> SBV (WordN w)
forall a b. (Integral a, Num b) => a -> b
fromIntegral WordN w
n
symSBVName :: TypedSymbol 'AnyKind (WordN w) -> Int -> String
symSBVName TypedSymbol 'AnyKind (WordN w)
symbol Int
_ = TypedSymbol 'AnyKind (WordN w) -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind (WordN w)
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType (WordN w))
symSBVTerm String
name = Proxy w
-> (BVIsNonZero w => m (SBVType (WordN w)))
-> m (SBVType (WordN w))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => m (SBVType (WordN w))) -> m (SBVType (WordN w)))
-> (BVIsNonZero w => m (SBVType (WordN w)))
-> m (SBVType (WordN w))
forall a b. (a -> b) -> a -> b
$ String -> m (SBV (WordN w))
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
withPrim :: forall a.
((PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
a)
-> a
withPrim (PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
a
r = Proxy w -> (BVIsNonZero w => a) -> a
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) a
BVIsNonZero w => a
(PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
a
r
{-# INLINE withPrim #-}
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> WordN w
parseSMTModelResult Int
_ ([([CV], CV)], CV)
cv =
forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(WordN w) (((PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
WordN w)
-> WordN w)
-> ((PrimConstraint (WordN w), SMTDefinable (SBVType (WordN w)),
Mergeable (SBVType (WordN w)), Typeable (SBVType (WordN w))) =>
WordN w)
-> WordN w
forall a b. (a -> b) -> a -> b
$
(WordN w -> WordN w) -> ([([CV], CV)], CV) -> WordN w
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult (\(WordN w
x :: SBV.WordN w) -> WordN w -> WordN w
forall a b. (Integral a, Num b) => a -> b
fromIntegral WordN w
x) ([([CV], CV)], CV)
cv
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd (WordN w) ->
Maybe (TypedSymbol knd' (WordN w))
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd (WordN w) -> Maybe (TypedSymbol knd' (WordN w))
castTypedSymbol TypedSymbol knd (WordN w)
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w))
forall a. a -> Maybe a
Just (TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w)))
-> TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind (WordN w)
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind (WordN w))
-> Symbol -> TypedSymbol 'ConstantKind (WordN w)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (WordN w) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (WordN w)
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w))
forall a. a -> Maybe a
Just (TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w)))
-> TypedSymbol knd' (WordN w) -> Maybe (TypedSymbol knd' (WordN w))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind (WordN w)
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind (WordN w))
-> Symbol -> TypedSymbol 'AnyKind (WordN w)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (WordN w) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (WordN w)
s
funcDummyConstraint :: SBVType (WordN w) -> SBV Bool
funcDummyConstraint SBVType (WordN w)
_ = SBV Bool
SBV.sTrue
instance (KnownNat w, 1 <= w) => NonFuncSBVRep (WordN w) where
type NonFuncSBVBaseType (WordN w) = SBV.WordN w
instance (KnownNat w, 1 <= w) => SupportedNonFuncPrim (WordN w) where
conNonFuncSBVTerm :: WordN w -> SBV (NonFuncSBVBaseType (WordN w))
conNonFuncSBVTerm = WordN w -> SBV (NonFuncSBVBaseType (WordN w))
WordN w -> SBVType (WordN w)
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType (WordN w)))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @(WordN w)
withNonFuncPrim :: forall r. (NonFuncPrimConstraint (WordN w) => r) -> r
withNonFuncPrim NonFuncPrimConstraint (WordN w) => r
r = Proxy w -> (BVIsNonZero w => r) -> r
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) r
NonFuncPrimConstraint (WordN w) => r
BVIsNonZero w => r
r
instance (ValidFP eb sb) => SupportedPrimConstraint (FP eb sb) where
type PrimConstraint (FP eb sb) = ValidFP eb sb
instance (ValidFP eb sb) => SBVRep (FP eb sb) where
type SBVType (FP eb sb) = SBV.SBV (SBV.FloatingPoint eb sb)
instance (ValidFP eb sb) => SupportedPrim (FP eb sb) where
sameCon :: FP eb sb -> FP eb sb -> Bool
sameCon FP eb sb
a FP eb sb
b
| FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
isNaN FP eb sb
a = FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
isNaN FP eb sb
b
| FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
fpIsPositiveZero FP eb sb
a = FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
fpIsPositiveZero FP eb sb
b
| FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
fpIsNegativeZero FP eb sb
a = FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
fpIsNegativeZero FP eb sb
b
| Bool
otherwise = FP eb sb
a FP eb sb -> FP eb sb -> Bool
forall a. Eq a => a -> a -> Bool
== FP eb sb
b
hashConWithSalt :: Int -> FP eb sb -> Int
hashConWithSalt Int
s FP eb sb
a
| FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
isNaN FP eb sb
a = Int -> Int -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (Int
2654435761 :: Int)
| Bool
otherwise = Int -> FP eb sb -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s FP eb sb
a
defaultValue :: FP eb sb
defaultValue = FP eb sb
0
pevalITETerm :: Term Bool -> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
pevalITETerm = Term Bool -> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm
pevalEqTerm :: Term (FP eb sb) -> Term (FP eb sb) -> Term Bool
pevalEqTerm (ConTerm FP eb sb
l) (ConTerm FP eb sb
r) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ FP eb sb
l FP eb sb -> FP eb sb -> Bool
forall a. Eq a => a -> a -> Bool
== FP eb sb
r
pevalEqTerm l :: Term (FP eb sb)
l@ConTerm {} Term (FP eb sb)
r = Term (FP eb sb) -> Term (FP eb sb) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term (FP eb sb)
r Term (FP eb sb)
l
pevalEqTerm Term (FP eb sb)
l Term (FP eb sb)
r = Term (FP eb sb) -> Term (FP eb sb) -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term (FP eb sb)
l Term (FP eb sb)
r
pevalDistinctTerm :: NonEmpty (Term (FP eb sb)) -> Term Bool
pevalDistinctTerm (Term (FP eb sb)
_ :| []) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
pevalDistinctTerm (Term (FP eb sb)
a :| [Term (FP eb sb)
b]) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term (FP eb sb) -> Term (FP eb sb) -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term (FP eb sb)
a Term (FP eb sb)
b
pevalDistinctTerm NonEmpty (Term (FP eb sb))
l =
case [Term (FP eb sb)] -> Maybe [FP eb sb]
forall a. [Term a] -> Maybe [a]
getAllConcrete (NonEmpty (Term (FP eb sb)) -> [Term (FP eb sb)]
forall a. NonEmpty a -> [a]
toList NonEmpty (Term (FP eb sb))
l) of
Maybe [FP eb sb]
Nothing -> NonEmpty (Term (FP eb sb)) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term (FP eb sb))
l
Just [FP eb sb]
xs | (FP eb sb -> Bool) -> [FP eb sb] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any FP eb sb -> Bool
forall a. RealFloat a => a -> Bool
isNaN [FP eb sb]
xs -> NonEmpty (Term (FP eb sb)) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term (FP eb sb))
l
Just [FP eb sb]
xs -> Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ [FP eb sb] -> Bool
forall t. Eq t => [t] -> Bool
checkConcreteDistinct [FP eb sb]
xs
conSBVTerm :: FP eb sb -> SBVType (FP eb sb)
conSBVTerm (FP FloatingPoint eb sb
fp) = FloatingPoint eb sb -> SBV (FloatingPoint eb sb)
forall a. SymVal a => a -> SBV a
SBV.literal FloatingPoint eb sb
fp
symSBVName :: TypedSymbol 'AnyKind (FP eb sb) -> Int -> String
symSBVName TypedSymbol 'AnyKind (FP eb sb)
symbol Int
_ = TypedSymbol 'AnyKind (FP eb sb) -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind (FP eb sb)
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType (FP eb sb))
symSBVTerm String
name = String -> m (SBV (FloatingPoint eb sb))
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> FP eb sb
parseSMTModelResult Int
_ ([([CV], CV)], CV)
cv =
forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(FP eb sb) (((PrimConstraint (FP eb sb), SMTDefinable (SBVType (FP eb sb)),
Mergeable (SBVType (FP eb sb)), Typeable (SBVType (FP eb sb))) =>
FP eb sb)
-> FP eb sb)
-> ((PrimConstraint (FP eb sb), SMTDefinable (SBVType (FP eb sb)),
Mergeable (SBVType (FP eb sb)), Typeable (SBVType (FP eb sb))) =>
FP eb sb)
-> FP eb sb
forall a b. (a -> b) -> a -> b
$
(FloatingPoint eb sb -> FP eb sb) -> ([([CV], CV)], CV) -> FP eb sb
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult (\(FloatingPoint eb sb
x :: SBV.FloatingPoint eb sb) -> FloatingPoint eb sb -> FP eb sb
forall a b. Coercible a b => a -> b
coerce FloatingPoint eb sb
x) ([([CV], CV)], CV)
cv
funcDummyConstraint :: SBVType (FP eb sb) -> SBV Bool
funcDummyConstraint SBVType (FP eb sb)
_ = SBV Bool
SBV.sTrue
sbvIte :: SBV Bool
-> SBVType (FP eb sb) -> SBVType (FP eb sb) -> SBVType (FP eb sb)
sbvIte = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(FP eb sb) (((PrimConstraint (FP eb sb), SMTDefinable (SBVType (FP eb sb)),
Mergeable (SBVType (FP eb sb)), Typeable (SBVType (FP eb sb))) =>
SBV Bool
-> SBVType (FP eb sb) -> SBVType (FP eb sb) -> SBVType (FP eb sb))
-> SBV Bool
-> SBVType (FP eb sb)
-> SBVType (FP eb sb)
-> SBVType (FP eb sb))
-> ((PrimConstraint (FP eb sb), SMTDefinable (SBVType (FP eb sb)),
Mergeable (SBVType (FP eb sb)), Typeable (SBVType (FP eb sb))) =>
SBV Bool
-> SBVType (FP eb sb) -> SBVType (FP eb sb) -> SBVType (FP eb sb))
-> SBV Bool
-> SBVType (FP eb sb)
-> SBVType (FP eb sb)
-> SBVType (FP eb sb)
forall a b. (a -> b) -> a -> b
$ \SBV Bool
c SBVType (FP eb sb)
a SBVType (FP eb sb)
b ->
case (SBV (FloatingPoint eb sb) -> Maybe (FloatingPoint eb sb)
forall a. SymVal a => SBV a -> Maybe a
SBV.unliteral SBV (FloatingPoint eb sb)
SBVType (FP eb sb)
a, SBV (FloatingPoint eb sb) -> Maybe (FloatingPoint eb sb)
forall a. SymVal a => SBV a -> Maybe a
SBV.unliteral SBV (FloatingPoint eb sb)
SBVType (FP eb sb)
b) of
(Just FloatingPoint eb sb
a', Just FloatingPoint eb sb
b')
| FloatingPoint eb sb -> Bool
forall a. RealFloat a => a -> Bool
isInfinite FloatingPoint eb sb
a' Bool -> Bool -> Bool
&& FloatingPoint eb sb -> Bool
forall a. RealFloat a => a -> Bool
isInfinite FloatingPoint eb sb
b' ->
let correspondingZero :: a -> a
correspondingZero a
x = if a
x a -> a -> Bool
forall a. Ord a => a -> a -> Bool
> a
0 then a
0 else -a
0
in SBV (FloatingPoint eb sb)
1
SBV (FloatingPoint eb sb)
-> SBV (FloatingPoint eb sb) -> SBV (FloatingPoint eb sb)
forall a. Fractional a => a -> a -> a
/ forall t.
SupportedPrim t =>
SBV Bool -> SBVType t -> SBVType t -> SBVType t
sbvIte @(FP eb sb)
SBV Bool
c
(forall t. SupportedPrim t => t -> SBVType t
conSBVTerm @(FP eb sb) (FP eb sb -> SBVType (FP eb sb)) -> FP eb sb -> SBVType (FP eb sb)
forall a b. (a -> b) -> a -> b
$ FloatingPoint eb sb -> FP eb sb
forall {a} {a}. (Ord a, Num a, Num a) => a -> a
correspondingZero FloatingPoint eb sb
a')
(forall t. SupportedPrim t => t -> SBVType t
conSBVTerm @(FP eb sb) (FP eb sb -> SBVType (FP eb sb)) -> FP eb sb -> SBVType (FP eb sb)
forall a b. (a -> b) -> a -> b
$ FloatingPoint eb sb -> FP eb sb
forall {a} {a}. (Ord a, Num a, Num a) => a -> a
correspondingZero FloatingPoint eb sb
b')
(Maybe (FloatingPoint eb sb), Maybe (FloatingPoint eb sb))
_ -> SBV Bool
-> SBV (FloatingPoint eb sb)
-> SBV (FloatingPoint eb sb)
-> SBV (FloatingPoint eb sb)
forall a. Mergeable a => SBV Bool -> a -> a -> a
SBV.ite SBV Bool
c SBV (FloatingPoint eb sb)
SBVType (FP eb sb)
a SBV (FloatingPoint eb sb)
SBVType (FP eb sb)
b
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd (FP eb sb) ->
Maybe (TypedSymbol knd' (FP eb sb))
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd (FP eb sb) -> Maybe (TypedSymbol knd' (FP eb sb))
castTypedSymbol TypedSymbol knd (FP eb sb)
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' (FP eb sb) -> Maybe (TypedSymbol knd' (FP eb sb))
forall a. a -> Maybe a
Just (TypedSymbol knd' (FP eb sb)
-> Maybe (TypedSymbol knd' (FP eb sb)))
-> TypedSymbol knd' (FP eb sb)
-> Maybe (TypedSymbol knd' (FP eb sb))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind (FP eb sb)
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind (FP eb sb))
-> Symbol -> TypedSymbol 'ConstantKind (FP eb sb)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (FP eb sb) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (FP eb sb)
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' (FP eb sb) -> Maybe (TypedSymbol knd' (FP eb sb))
forall a. a -> Maybe a
Just (TypedSymbol knd' (FP eb sb)
-> Maybe (TypedSymbol knd' (FP eb sb)))
-> TypedSymbol knd' (FP eb sb)
-> Maybe (TypedSymbol knd' (FP eb sb))
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind (FP eb sb)
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind (FP eb sb))
-> Symbol -> TypedSymbol 'AnyKind (FP eb sb)
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd (FP eb sb) -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd (FP eb sb)
s
instance (ValidFP eb sb) => NonFuncSBVRep (FP eb sb) where
type NonFuncSBVBaseType (FP eb sb) = SBV.FloatingPoint eb sb
instance (ValidFP eb sb) => SupportedNonFuncPrim (FP eb sb) where
conNonFuncSBVTerm :: FP eb sb -> SBV (NonFuncSBVBaseType (FP eb sb))
conNonFuncSBVTerm = FP eb sb -> SBV (NonFuncSBVBaseType (FP eb sb))
FP eb sb -> SBVType (FP eb sb)
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType (FP eb sb)))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @(FP eb sb)
withNonFuncPrim :: forall r. (NonFuncPrimConstraint (FP eb sb) => r) -> r
withNonFuncPrim NonFuncPrimConstraint (FP eb sb) => r
r = r
NonFuncPrimConstraint (FP eb sb) => r
r
instance SupportedPrimConstraint FPRoundingMode
instance SBVRep FPRoundingMode where
type SBVType FPRoundingMode = SBV.SBV SBV.RoundingMode
instance SupportedPrim FPRoundingMode where
defaultValue :: FPRoundingMode
defaultValue = FPRoundingMode
RNE
pevalITETerm :: Term Bool
-> Term FPRoundingMode
-> Term FPRoundingMode
-> Term FPRoundingMode
pevalITETerm = Term Bool
-> Term FPRoundingMode
-> Term FPRoundingMode
-> Term FPRoundingMode
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm
pevalEqTerm :: Term FPRoundingMode -> Term FPRoundingMode -> Term Bool
pevalEqTerm (ConTerm FPRoundingMode
l) (ConTerm FPRoundingMode
r) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ FPRoundingMode
l FPRoundingMode -> FPRoundingMode -> Bool
forall a. Eq a => a -> a -> Bool
== FPRoundingMode
r
pevalEqTerm l :: Term FPRoundingMode
l@ConTerm {} Term FPRoundingMode
r = Term FPRoundingMode -> Term FPRoundingMode -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term FPRoundingMode
r Term FPRoundingMode
l
pevalEqTerm Term FPRoundingMode
l Term FPRoundingMode
r = Term FPRoundingMode -> Term FPRoundingMode -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term FPRoundingMode
l Term FPRoundingMode
r
pevalDistinctTerm :: NonEmpty (Term FPRoundingMode) -> Term Bool
pevalDistinctTerm = NonEmpty (Term FPRoundingMode) -> Term Bool
forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct
conSBVTerm :: FPRoundingMode -> SBVType FPRoundingMode
conSBVTerm FPRoundingMode
RNE = SBV RoundingMode
SBVType FPRoundingMode
SBV.sRNE
conSBVTerm FPRoundingMode
RNA = SBV RoundingMode
SBVType FPRoundingMode
SBV.sRNA
conSBVTerm FPRoundingMode
RTP = SBV RoundingMode
SBVType FPRoundingMode
SBV.sRTP
conSBVTerm FPRoundingMode
RTN = SBV RoundingMode
SBVType FPRoundingMode
SBV.sRTN
conSBVTerm FPRoundingMode
RTZ = SBV RoundingMode
SBVType FPRoundingMode
SBV.sRTZ
symSBVName :: TypedSymbol 'AnyKind FPRoundingMode -> Int -> String
symSBVName TypedSymbol 'AnyKind FPRoundingMode
symbol Int
_ = TypedSymbol 'AnyKind FPRoundingMode -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind FPRoundingMode
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType FPRoundingMode)
symSBVTerm String
name = String -> m (SBV RoundingMode)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> FPRoundingMode
parseSMTModelResult Int
_ ([([CV], CV)], CV)
cv =
forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(FPRoundingMode) (((PrimConstraint FPRoundingMode,
SMTDefinable (SBVType FPRoundingMode),
Mergeable (SBVType FPRoundingMode),
Typeable (SBVType FPRoundingMode)) =>
FPRoundingMode)
-> FPRoundingMode)
-> ((PrimConstraint FPRoundingMode,
SMTDefinable (SBVType FPRoundingMode),
Mergeable (SBVType FPRoundingMode),
Typeable (SBVType FPRoundingMode)) =>
FPRoundingMode)
-> FPRoundingMode
forall a b. (a -> b) -> a -> b
$
(RoundingMode -> FPRoundingMode)
-> ([([CV], CV)], CV) -> FPRoundingMode
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult
( \(RoundingMode
x :: SBV.RoundingMode) -> case RoundingMode
x of
RoundingMode
SBV.RoundNearestTiesToEven -> FPRoundingMode
RNE
RoundingMode
SBV.RoundNearestTiesToAway -> FPRoundingMode
RNA
RoundingMode
SBV.RoundTowardPositive -> FPRoundingMode
RTP
RoundingMode
SBV.RoundTowardNegative -> FPRoundingMode
RTN
RoundingMode
SBV.RoundTowardZero -> FPRoundingMode
RTZ
)
([([CV], CV)], CV)
cv
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd FPRoundingMode ->
Maybe (TypedSymbol knd' FPRoundingMode)
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode)
castTypedSymbol TypedSymbol knd FPRoundingMode
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode)
forall a. a -> Maybe a
Just (TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode))
-> TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind FPRoundingMode
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind FPRoundingMode)
-> Symbol -> TypedSymbol 'ConstantKind FPRoundingMode
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd FPRoundingMode -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd FPRoundingMode
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode)
forall a. a -> Maybe a
Just (TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode))
-> TypedSymbol knd' FPRoundingMode
-> Maybe (TypedSymbol knd' FPRoundingMode)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind FPRoundingMode
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind FPRoundingMode)
-> Symbol -> TypedSymbol 'AnyKind FPRoundingMode
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd FPRoundingMode -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd FPRoundingMode
s
funcDummyConstraint :: SBVType FPRoundingMode -> SBV Bool
funcDummyConstraint SBVType FPRoundingMode
_ = SBV Bool
SBV.sTrue
instance NonFuncSBVRep FPRoundingMode where
type NonFuncSBVBaseType FPRoundingMode = SBV.RoundingMode
instance SupportedNonFuncPrim FPRoundingMode where
conNonFuncSBVTerm :: FPRoundingMode -> SBV (NonFuncSBVBaseType FPRoundingMode)
conNonFuncSBVTerm = FPRoundingMode -> SBV (NonFuncSBVBaseType FPRoundingMode)
FPRoundingMode -> SBVType FPRoundingMode
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType FPRoundingMode))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @FPRoundingMode
withNonFuncPrim :: forall r. (NonFuncPrimConstraint FPRoundingMode => r) -> r
withNonFuncPrim NonFuncPrimConstraint FPRoundingMode => r
r = r
NonFuncPrimConstraint FPRoundingMode => r
r
instance SupportedPrimConstraint AlgReal
instance SBVRep AlgReal where
type SBVType AlgReal = SBV.SBV SBV.AlgReal
instance SupportedPrim AlgReal where
defaultValue :: AlgReal
defaultValue = AlgReal
0
pevalITETerm :: Term Bool -> Term AlgReal -> Term AlgReal -> Term AlgReal
pevalITETerm = Term Bool -> Term AlgReal -> Term AlgReal -> Term AlgReal
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm
pevalEqTerm :: Term AlgReal -> Term AlgReal -> Term Bool
pevalEqTerm (ConTerm AlgReal
l) (ConTerm AlgReal
r) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ AlgReal
l AlgReal -> AlgReal -> Bool
forall a. Eq a => a -> a -> Bool
== AlgReal
r
pevalEqTerm l :: Term AlgReal
l@ConTerm {} Term AlgReal
r = Term AlgReal -> Term AlgReal -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term AlgReal
r Term AlgReal
l
pevalEqTerm Term AlgReal
l Term AlgReal
r = Term AlgReal -> Term AlgReal -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term AlgReal
l Term AlgReal
r
pevalDistinctTerm :: NonEmpty (Term AlgReal) -> Term Bool
pevalDistinctTerm = NonEmpty (Term AlgReal) -> Term Bool
forall a. SupportedNonFuncPrim a => NonEmpty (Term a) -> Term Bool
pevalGeneralDistinct
conSBVTerm :: AlgReal -> SBVType AlgReal
conSBVTerm = AlgReal -> SBV AlgReal
forall a. SymVal a => a -> SBV a
SBV.literal (AlgReal -> SBV AlgReal)
-> (AlgReal -> AlgReal) -> AlgReal -> SBV AlgReal
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AlgReal -> AlgReal
toSBVAlgReal
symSBVName :: TypedSymbol 'AnyKind AlgReal -> Int -> String
symSBVName TypedSymbol 'AnyKind AlgReal
symbol Int
_ = TypedSymbol 'AnyKind AlgReal -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind AlgReal
symbol
symSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBVType AlgReal)
symSBVTerm String
name = String -> m (SBV AlgReal)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh String
name
parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> AlgReal
parseSMTModelResult Int
_ ([([CV], CV)], CV)
cv =
forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @AlgReal (((PrimConstraint AlgReal, SMTDefinable (SBVType AlgReal),
Mergeable (SBVType AlgReal), Typeable (SBVType AlgReal)) =>
AlgReal)
-> AlgReal)
-> ((PrimConstraint AlgReal, SMTDefinable (SBVType AlgReal),
Mergeable (SBVType AlgReal), Typeable (SBVType AlgReal)) =>
AlgReal)
-> AlgReal
forall a b. (a -> b) -> a -> b
$
(AlgReal -> AlgReal) -> ([([CV], CV)], CV) -> AlgReal
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult AlgReal -> AlgReal
fromSBVAlgReal ([([CV], CV)], CV)
cv
castTypedSymbol ::
forall knd knd'.
(IsSymbolKind knd') =>
TypedSymbol knd AlgReal ->
Maybe (TypedSymbol knd' AlgReal)
castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd AlgReal -> Maybe (TypedSymbol knd' AlgReal)
castTypedSymbol TypedSymbol knd AlgReal
s =
case forall (knd :: SymbolKind).
IsSymbolKind knd =>
Either (knd :~~: 'ConstantKind) (knd :~~: 'AnyKind)
decideSymbolKind @knd' of
Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal)
forall a. a -> Maybe a
Just (TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal))
-> TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'ConstantKind AlgReal
forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol (Symbol -> TypedSymbol 'ConstantKind AlgReal)
-> Symbol -> TypedSymbol 'ConstantKind AlgReal
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd AlgReal -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd AlgReal
s
Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal)
forall a. a -> Maybe a
Just (TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal))
-> TypedSymbol knd' AlgReal -> Maybe (TypedSymbol knd' AlgReal)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind AlgReal
forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol (Symbol -> TypedSymbol 'AnyKind AlgReal)
-> Symbol -> TypedSymbol 'AnyKind AlgReal
forall a b. (a -> b) -> a -> b
$ TypedSymbol knd AlgReal -> Symbol
forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol TypedSymbol knd AlgReal
s
funcDummyConstraint :: SBVType AlgReal -> SBV Bool
funcDummyConstraint SBVType AlgReal
_ = SBV Bool
SBV.sTrue
instance NonFuncSBVRep AlgReal where
type NonFuncSBVBaseType AlgReal = SBV.AlgReal
instance SupportedNonFuncPrim AlgReal where
conNonFuncSBVTerm :: AlgReal -> SBV (NonFuncSBVBaseType AlgReal)
conNonFuncSBVTerm = AlgReal -> SBV (NonFuncSBVBaseType AlgReal)
AlgReal -> SBVType AlgReal
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType AlgReal))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @AlgReal
withNonFuncPrim :: forall r. (NonFuncPrimConstraint AlgReal => r) -> r
withNonFuncPrim NonFuncPrimConstraint AlgReal => r
r = r
NonFuncPrimConstraint AlgReal => r
r
bitOpOnConcat ::
forall bv m.
( forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv,
KnownNat m,
1 <= m
) =>
( forall n.
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
) ->
Term (bv m) ->
Term (bv m) ->
Maybe (Term (bv m))
bitOpOnConcat :: forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n))
-> Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
bitOpOnConcat
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval
(BVConcatTerm (Term (bv l)
l0 :: Term (bv l)) (Term (bv r)
r0 :: Term (bv r)))
(BVConcatTerm (DynTerm (Term (bv l)
l :: Term (bv l))) (DynTerm (Term (bv r)
r :: Term (bv r)))) =
let r' :: Term (bv r)
r' = Term (bv r) -> Term (bv r) -> Term (bv r)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval Term (bv r)
r0 Term (bv r)
r
l' :: Term (bv l)
l' = Term (bv l) -> Term (bv l) -> Term (bv l)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval Term (bv l)
l0 Term (bv l)
l
in Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm Term (bv l)
l' Term (bv r)
r'
bitOpOnConcat
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval
at :: Term (bv m)
at@(ConTerm bv m
_)
(BVConcatTerm (Term (bv l)
l :: Term (bv l)) (Term (bv r)
r :: Term (bv r))) =
let nzero :: NatRepr 0
nzero = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @0
nr :: NatRepr r
nr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
nl :: NatRepr l
nl = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
nlpr :: NatRepr (l + r)
nlpr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @(l + r)
ar :: Term (bv r)
ar =
NatRepr m -> NatRepr 0 -> NatRepr r -> Term (bv m) -> Term (bv r)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm
NatRepr m
NatRepr (l + r)
nlpr
NatRepr 0
nzero
NatRepr r
nr
(Term (bv m) -> Term (bv m)
forall a b. a -> b
unsafeCoerce Term (bv m)
at :: Term (bv (l + r)))
al :: Term (bv l)
al =
NatRepr m -> NatRepr r -> NatRepr l -> Term (bv m) -> Term (bv l)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm
NatRepr m
NatRepr (l + r)
nlpr
NatRepr r
nr
NatRepr l
nl
(Term (bv m) -> Term (bv m)
forall a b. a -> b
unsafeCoerce Term (bv m)
at :: Term (bv (l + r)))
r' :: Term (bv r)
r' = Term (bv r) -> Term (bv r) -> Term (bv r)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval Term (bv r)
ar Term (bv r)
r
l' :: Term (bv l)
l' = Term (bv l) -> Term (bv l) -> Term (bv l)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval Term (bv l)
al Term (bv l)
l
in Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm Term (bv l)
l' Term (bv r)
r'
bitOpOnConcat
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval
(BVExtendTerm Bool
True Proxy r
pl (Term (bv l)
l :: Term (bv n)))
(BVExtendTerm Bool
True Proxy r
_ (DynTerm (Term (bv l)
r :: Term (bv n)))) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl (Term (bv l) -> Term (bv l) -> Term (bv l)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
peval Term (bv l)
l Term (bv l)
r)
bitOpOnConcat forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
_ Term (bv m)
_ Term (bv m)
_ = Maybe (Term (bv m))
forall a. Maybe a
Nothing
doPevalAndBitsTerm ::
forall bv m.
( forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv,
KnownNat m,
1 <= m
) =>
Term (bv m) ->
Term (bv m) ->
Maybe (Term (bv m))
doPevalAndBitsTerm :: forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalAndBitsTerm (ConTerm bv m
a) (ConTerm bv m
b) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm (bv m
a bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.&. bv m
b)
doPevalAndBitsTerm (ConTerm bv m
a) Term (bv m)
b
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm bv m
forall a. Bits a => a
zeroBits
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m -> bv m
forall a. Bits a => a -> a
complement bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just Term (bv m)
b
| Bool
aok Bool -> Bool -> Bool
|| Bool
acok =
case ( Natural -> SomePositiveNatRepr
mkPositiveNatRepr (Natural -> SomePositiveNatRepr) -> Natural -> SomePositiveNatRepr
forall a b. (a -> b) -> a -> b
$ Int -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
leadingBits,
Natural -> SomePositiveNatRepr
mkPositiveNatRepr (Natural -> SomePositiveNatRepr) -> Natural -> SomePositiveNatRepr
forall a b. (a -> b) -> a -> b
$ Int -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
trailingBits
) of
( SomePositiveNatRepr (NatRepr n
pleadingBits :: NatRepr leadingBits),
SomePositiveNatRepr (NatRepr n
ptrailingBitsRepr :: NatRepr trailingBits)
) ->
case ( forall (a :: Natural) (b :: Natural). a :~: b
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom @(leadingBits + trailingBits) @m,
forall (a :: Natural) (b :: Natural). a :~: b
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom @(trailingBits + leadingBits) @m,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @trailingBits @m
) of
((n + n) :~: m
Refl, (n + n) :~: m
Refl, LeqProof n m
LeqProof) ->
if Bool
aok
then
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term (bv n) -> Term (bv n) -> Term (bv (n + n))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm (bv n -> Term (bv n)
forall t. SupportedPrim t => t -> Term t
conTerm bv n
0 :: Term (bv leadingBits)) (Term (bv n) -> Term (bv (n + n)))
-> Term (bv n) -> Term (bv (n + n))
forall a b. (a -> b) -> a -> b
$
NatRepr 0 -> NatRepr n -> Term (bv m) -> Term (bv n)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @0) NatRepr n
ptrailingBitsRepr Term (bv m)
b
else
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term (bv n) -> Term (bv n) -> Term (bv (n + n))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(NatRepr n -> NatRepr n -> Term (bv m) -> Term (bv n)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm NatRepr n
ptrailingBitsRepr NatRepr n
pleadingBits Term (bv m)
b)
(bv n -> Term (bv n)
forall t. SupportedPrim t => t -> Term t
conTerm bv n
0 :: Term (bv trailingBits))
where
leadingBits :: Int
leadingBits = if Bool
aok then bv m -> Int
forall b. FiniteBits b => b -> Int
countLeadingZeros bv m
a else bv m -> Int
forall b. FiniteBits b => b -> Int
countLeadingZeros bv m
ac
trailingBits :: Int
trailingBits = Natural -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @m bv m
a) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
leadingBits
ac :: bv m
ac = bv m -> bv m
forall a. Bits a => a -> a
complement bv m
a
aok :: Bool
aok = bv m
a bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.&. (bv m
a bv m -> bv m -> bv m
forall a. Num a => a -> a -> a
+ bv m
1) bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0
acok :: Bool
acok = bv m
ac bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.&. (bv m
ac bv m -> bv m -> bv m
forall a. Num a => a -> a -> a
+ bv m
1) bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0
doPevalAndBitsTerm Term (bv m)
a b :: Term (bv m)
b@(ConTerm bv m
_) = Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalAndBitsTerm Term (bv m)
b Term (bv m)
a
doPevalAndBitsTerm Term (bv m)
a Term (bv m)
b | Term (bv m)
a Term (bv m) -> Term (bv m) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv m)
b = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just Term (bv m)
a
doPevalAndBitsTerm (ITETerm Term Bool
cond a :: Term (bv m)
a@(ConTerm bv m
av) b :: Term (bv m)
b@(ConTerm bv m
bv)) Term (bv m)
c
| bv m
av bv m -> [bv m] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv m
0, -bv m
1] Bool -> Bool -> Bool
|| bv m
bv bv m -> [bv m] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv m
0, -bv m
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
c) (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
b Term (bv m)
c)
doPevalAndBitsTerm Term (bv m)
a (ITETerm Term Bool
cond b :: Term (bv m)
b@(ConTerm bv m
bv) c :: Term (bv m)
c@(ConTerm bv m
cv))
| bv m
bv bv m -> [bv m] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv m
0, -bv m
1] Bool -> Bool -> Bool
|| bv m
cv bv m -> [bv m] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv m
0, -bv m
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
b) (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
c)
doPevalAndBitsTerm (ITETerm Term Bool
cond a :: Term (bv m)
a@(ConTerm bv m
v) Term (bv m)
b) Term (bv m)
c
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv m)
a (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
b Term (bv m)
c)
doPevalAndBitsTerm (ITETerm Term Bool
cond Term (bv m)
a b :: Term (bv m)
b@(ConTerm bv m
v)) Term (bv m)
c
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
c) Term (bv m)
b
doPevalAndBitsTerm Term (bv m)
a (ITETerm Term Bool
cond b :: Term (bv m)
b@(ConTerm bv m
v) Term (bv m)
c)
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv m)
b (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
c)
doPevalAndBitsTerm Term (bv m)
a (ITETerm Term Bool
cond Term (bv m)
b c :: Term (bv m)
c@(ConTerm bv m
v))
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a Term (bv m)
b) Term (bv m)
c
doPevalAndBitsTerm (BVExtendTerm Bool
True Proxy r
pl (ITETerm Term Bool
cond at :: Term (bv l)
at@(ConTerm bv l
a) bt :: Term (bv l)
bt@(ConTerm bv l
b))) Term (bv m)
c
| bv l
a bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] Bool -> Bool -> Bool
&& bv l
b bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm
Term Bool
cond
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
at) Term (bv m)
c)
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
bt) Term (bv m)
c)
doPevalAndBitsTerm Term (bv m)
a (BVExtendTerm Bool
True Proxy r
pl (ITETerm Term Bool
cond bt :: Term (bv l)
bt@(ConTerm bv l
b) ct :: Term (bv l)
ct@(ConTerm bv l
c)))
| bv l
b bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] Bool -> Bool -> Bool
&& bv l
c bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm
Term Bool
cond
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
bt))
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalAndBitsTerm Term (bv m)
a (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
ct))
doPevalAndBitsTerm Term (bv m)
a Term (bv m)
b = forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n))
-> Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
bitOpOnConcat @bv @m Term (bv n) -> Term (bv n) -> Term (bv n)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultAndBitsTerm Term (bv m)
a Term (bv m)
b
pevalDefaultAndBitsTerm ::
forall bv m.
( forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv,
KnownNat m,
1 <= m
) =>
Term (bv m) ->
Term (bv m) ->
Term (bv m)
pevalDefaultAndBitsTerm :: forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultAndBitsTerm = PartialRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce PartialRuleBinary (bv m) (bv m) (bv m)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalAndBitsTerm TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
andBitsTerm
doPevalOrBitsTerm ::
forall bv m.
( forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv,
KnownNat m,
1 <= m
) =>
Term (bv m) ->
Term (bv m) ->
Maybe (Term (bv m))
doPevalOrBitsTerm :: forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalOrBitsTerm (ConTerm bv m
a) (ConTerm bv m
b) = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm (bv m
a bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.|. bv m
b)
doPevalOrBitsTerm (ConTerm bv m
a) Term (bv m)
b
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just Term (bv m)
b
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m -> bv m
forall a. Bits a => a -> a
complement bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm (bv m -> Term (bv m)) -> bv m -> Term (bv m)
forall a b. (a -> b) -> a -> b
$ bv m -> bv m
forall a. Bits a => a -> a
complement bv m
forall a. Bits a => a
zeroBits
| Bool
aok Bool -> Bool -> Bool
|| Bool
acok =
case ( Natural -> SomePositiveNatRepr
mkPositiveNatRepr (Natural -> SomePositiveNatRepr) -> Natural -> SomePositiveNatRepr
forall a b. (a -> b) -> a -> b
$ Int -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
leadingBits,
Natural -> SomePositiveNatRepr
mkPositiveNatRepr (Natural -> SomePositiveNatRepr) -> Natural -> SomePositiveNatRepr
forall a b. (a -> b) -> a -> b
$ Int -> Natural
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
trailingBits
) of
( SomePositiveNatRepr (NatRepr n
pleadingBits :: NatRepr leadingBits),
SomePositiveNatRepr (NatRepr n
ptrailingBitsRepr :: NatRepr trailingBits)
) ->
case ( forall (a :: Natural) (b :: Natural). a :~: b
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom @(leadingBits + trailingBits) @m,
forall (a :: Natural) (b :: Natural). a :~: b
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom @(trailingBits + leadingBits) @m,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @trailingBits @m
) of
((n + n) :~: m
Refl, (n + n) :~: m
Refl, LeqProof n m
LeqProof) ->
if Bool
acok
then
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term (bv n) -> Term (bv n) -> Term (bv (n + n))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm (bv n -> Term (bv n)
forall t. SupportedPrim t => t -> Term t
conTerm (bv n -> Term (bv n)) -> bv n -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ -bv n
1 :: Term (bv leadingBits)) (Term (bv n) -> Term (bv (n + n)))
-> Term (bv n) -> Term (bv (n + n))
forall a b. (a -> b) -> a -> b
$
NatRepr 0 -> NatRepr n -> Term (bv m) -> Term (bv n)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @0) NatRepr n
ptrailingBitsRepr Term (bv m)
b
else
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term (bv n) -> Term (bv n) -> Term (bv (n + n))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(NatRepr n -> NatRepr n -> Term (bv m) -> Term (bv n)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm NatRepr n
ptrailingBitsRepr NatRepr n
pleadingBits Term (bv m)
b)
(bv n -> Term (bv n)
forall t. SupportedPrim t => t -> Term t
conTerm (bv n -> Term (bv n)) -> bv n -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ -bv n
1 :: Term (bv trailingBits))
where
leadingBits :: Int
leadingBits = if Bool
aok then bv m -> Int
forall b. FiniteBits b => b -> Int
countLeadingZeros bv m
a else bv m -> Int
forall b. FiniteBits b => b -> Int
countLeadingZeros bv m
ac
trailingBits :: Int
trailingBits = Natural -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @m bv m
a) Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
leadingBits
ac :: bv m
ac = bv m -> bv m
forall a. Bits a => a -> a
complement bv m
a
aok :: Bool
aok = bv m
a bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.&. (bv m
a bv m -> bv m -> bv m
forall a. Num a => a -> a -> a
+ bv m
1) bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0
acok :: Bool
acok = bv m
ac bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
.&. (bv m
ac bv m -> bv m -> bv m
forall a. Num a => a -> a -> a
+ bv m
1) bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
0
doPevalOrBitsTerm Term (bv m)
a b :: Term (bv m)
b@(ConTerm bv m
_) = Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalOrBitsTerm Term (bv m)
b Term (bv m)
a
doPevalOrBitsTerm Term (bv m)
a Term (bv m)
b | Term (bv m)
a Term (bv m) -> Term (bv m) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv m)
b = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just Term (bv m)
a
doPevalOrBitsTerm (ITETerm Term Bool
cond a :: Term (bv m)
a@(ConTerm bv m
_) b :: Term (bv m)
b@(ConTerm bv m
_)) Term (bv m)
c =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
c) (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
b Term (bv m)
c)
doPevalOrBitsTerm Term (bv m)
a (ITETerm Term Bool
cond b :: Term (bv m)
b@(ConTerm bv m
_) c :: Term (bv m)
c@(ConTerm bv m
_)) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
b) (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
c)
doPevalOrBitsTerm (ITETerm Term Bool
cond a :: Term (bv m)
a@(ConTerm bv m
v) Term (bv m)
b) Term (bv m)
c
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== -bv m
1 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv m)
a (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
b Term (bv m)
c)
doPevalOrBitsTerm (ITETerm Term Bool
cond Term (bv m)
a b :: Term (bv m)
b@(ConTerm bv m
v)) Term (bv m)
c
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== -bv m
1 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
c) Term (bv m)
b
doPevalOrBitsTerm Term (bv m)
a (ITETerm Term Bool
cond b :: Term (bv m)
b@(ConTerm bv m
v) Term (bv m)
c)
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== -bv m
1 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term (bv m)
b (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
c)
doPevalOrBitsTerm Term (bv m)
a (ITETerm Term Bool
cond Term (bv m)
b c :: Term (bv m)
c@(ConTerm bv m
v))
| bv m
v bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== -bv m
1 = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a Term (bv m)
b) Term (bv m)
c
doPevalOrBitsTerm (BVExtendTerm Bool
True Proxy r
pl (ITETerm Term Bool
cond at :: Term (bv l)
at@(ConTerm bv l
a) bt :: Term (bv l)
bt@(ConTerm bv l
b))) Term (bv m)
c
| bv l
a bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] Bool -> Bool -> Bool
&& bv l
b bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm
Term Bool
cond
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
at) Term (bv m)
c)
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
bt) Term (bv m)
c)
doPevalOrBitsTerm Term (bv m)
a (BVExtendTerm Bool
True Proxy r
pl (ITETerm Term Bool
cond bt :: Term (bv l)
bt@(ConTerm bv l
b) ct :: Term (bv l)
ct@(ConTerm bv l
c)))
| bv l
b bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] Bool -> Bool -> Bool
&& bv l
c bv l -> [bv l] -> Bool
forall {t}. Eq t => t -> [t] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [bv l
0, -bv l
1] =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$
Term Bool -> Term (bv m) -> Term (bv m) -> Term (bv m)
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm
Term Bool
cond
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
bt))
(Term (bv m) -> Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalOrBitsTerm Term (bv m)
a (Bool -> Proxy m -> Term (bv l) -> Term (bv m)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy m
Proxy r
pl Term (bv l)
Term (bv l)
ct))
doPevalOrBitsTerm Term (bv m)
a Term (bv m)
b = forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n))
-> Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
bitOpOnConcat @bv @m Term (bv n) -> Term (bv n) -> Term (bv n)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
forall (bv :: Natural -> *) (m :: Natural).
(KnownNat m, 1 <= m,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultOrBitsTerm Term (bv m)
a Term (bv m)
b
pevalDefaultOrBitsTerm ::
forall bv m.
( KnownNat m,
1 <= m,
forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv
) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultOrBitsTerm :: forall (bv :: Natural -> *) (m :: Natural).
(KnownNat m, 1 <= m,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultOrBitsTerm = PartialRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce PartialRuleBinary (bv m) (bv m) (bv m)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
doPevalOrBitsTerm TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
orBitsTerm
pevalDefaultXorBitsTerm ::
forall bv m.
( forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n),
PEvalBVTerm bv,
KnownNat m,
1 <= m
) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultXorBitsTerm :: forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultXorBitsTerm = PartialRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
-> TotalRuleBinary (bv m) (bv m) (bv m)
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce PartialRuleBinary (bv m) (bv m) (bv m)
doPevalXorBitsTerm TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
xorBitsTerm
where
doPevalXorBitsTerm :: PartialRuleBinary (bv m) (bv m) (bv m)
doPevalXorBitsTerm (ConTerm bv m
a) (ConTerm bv m
b) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm (bv m
a bv m -> bv m -> bv m
forall a. Bits a => a -> a -> a
`xor` bv m
b)
doPevalXorBitsTerm (ConTerm bv m
a) Term (bv m)
b
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just Term (bv m)
b
| bv m
a bv m -> bv m -> Bool
forall a. Eq a => a -> a -> Bool
== bv m -> bv m
forall a. Bits a => a -> a
complement bv m
forall a. Bits a => a
zeroBits = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv m)
b
doPevalXorBitsTerm Term (bv m)
a b :: Term (bv m)
b@(ConTerm bv m
_) = PartialRuleBinary (bv m) (bv m) (bv m)
doPevalXorBitsTerm Term (bv m)
b Term (bv m)
a
doPevalXorBitsTerm Term (bv m)
a Term (bv m)
b | Term (bv m)
a Term (bv m) -> Term (bv m) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv m)
b = Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ bv m -> Term (bv m)
forall t. SupportedPrim t => t -> Term t
conTerm bv m
forall a. Bits a => a
zeroBits
doPevalXorBitsTerm (ComplementBitsTerm Term (bv m)
i) (ComplementBitsTerm Term (bv m)
j) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalXorBitsTerm Term (bv m)
i Term (bv m)
j
doPevalXorBitsTerm (ComplementBitsTerm Term (bv m)
i) Term (bv m)
j =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm (Term (bv m) -> Term (bv m)) -> Term (bv m) -> Term (bv m)
forall a b. (a -> b) -> a -> b
$ TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalXorBitsTerm Term (bv m)
i Term (bv m)
j
doPevalXorBitsTerm Term (bv m)
i (ComplementBitsTerm Term (bv m)
j) =
Term (bv m) -> Maybe (Term (bv m))
forall a. a -> Maybe a
Just (Term (bv m) -> Maybe (Term (bv m)))
-> Term (bv m) -> Maybe (Term (bv m))
forall a b. (a -> b) -> a -> b
$ Term (bv m) -> Term (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm (Term (bv m) -> Term (bv m)) -> Term (bv m) -> Term (bv m)
forall a b. (a -> b) -> a -> b
$ TotalRuleBinary (bv m) (bv m) (bv m)
forall t. PEvalBitwiseTerm t => Term t -> Term t -> Term t
pevalXorBitsTerm Term (bv m)
i Term (bv m)
j
doPevalXorBitsTerm Term (bv m)
a Term (bv m)
b = forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n))
-> Term (bv m) -> Term (bv m) -> Maybe (Term (bv m))
bitOpOnConcat @bv @m Term (bv n) -> Term (bv n) -> Term (bv n)
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
Term (bv n) -> Term (bv n) -> Term (bv n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultXorBitsTerm Term (bv m)
a Term (bv m)
b
pevalDefaultComplementBitsTerm ::
(Bits a, SupportedPrim a, PEvalBitwiseTerm a) => Term a -> Term a
pevalDefaultComplementBitsTerm :: forall a.
(Bits a, SupportedPrim a, PEvalBitwiseTerm a) =>
Term a -> Term a
pevalDefaultComplementBitsTerm =
PartialRuleUnary a a -> TotalRuleUnary a a -> TotalRuleUnary a a
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary a a
forall {t}. Bits t => Term t -> Maybe (Term t)
doPevalComplementBitsTerm TotalRuleUnary a a
forall t. PEvalBitwiseTerm t => Term t -> Term t
complementBitsTerm
where
doPevalComplementBitsTerm :: Term t -> Maybe (Term t)
doPevalComplementBitsTerm (ConTerm t
a) = Term t -> Maybe (Term t)
forall a. a -> Maybe a
Just (Term t -> Maybe (Term t)) -> Term t -> Maybe (Term t)
forall a b. (a -> b) -> a -> b
$ t -> Term t
forall t. SupportedPrim t => t -> Term t
conTerm (t -> Term t) -> t -> Term t
forall a b. (a -> b) -> a -> b
$ t -> t
forall a. Bits a => a -> a
complement t
a
doPevalComplementBitsTerm (ComplementBitsTerm Term t
a) = Term t -> Maybe (Term t)
forall a. a -> Maybe a
Just Term t
a
doPevalComplementBitsTerm (BVConcatTerm Term (bv l)
l Term (bv r)
r) =
Term t -> Maybe (Term t)
forall a. a -> Maybe a
Just (Term t -> Maybe (Term t)) -> Term t -> Maybe (Term t)
forall a b. (a -> b) -> a -> b
$
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(Term (bv l) -> Term (bv l)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv l)
l)
(Term (bv r) -> Term (bv r)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv r)
r)
doPevalComplementBitsTerm (BVExtendTerm Bool
True Proxy r
pr Term (bv l)
t) =
Term (bv r) -> Maybe (Term (bv r))
forall a. a -> Maybe a
Just (Term (bv r) -> Maybe (Term (bv r)))
-> Term (bv r) -> Maybe (Term (bv r))
forall a b. (a -> b) -> a -> b
$ Bool -> Proxy r -> Term (bv l) -> Term (bv r)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True Proxy r
pr (Term (bv l) -> Term (bv r)) -> Term (bv l) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$ Term (bv l) -> Term (bv l)
forall t. PEvalBitwiseTerm t => Term t -> Term t
pevalComplementBitsTerm Term (bv l)
t
doPevalComplementBitsTerm Term t
_ = Maybe (Term t)
forall a. Maybe a
Nothing
instance (KnownNat n, 1 <= n) => PEvalBitwiseTerm (WordN n) where
pevalAndBitsTerm :: Term (WordN n) -> Term (WordN n) -> Term (WordN n)
pevalAndBitsTerm = Term (WordN n) -> Term (WordN n) -> Term (WordN n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultAndBitsTerm
pevalOrBitsTerm :: Term (WordN n) -> Term (WordN n) -> Term (WordN n)
pevalOrBitsTerm = Term (WordN n) -> Term (WordN n) -> Term (WordN n)
forall (bv :: Natural -> *) (m :: Natural).
(KnownNat m, 1 <= m,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultOrBitsTerm
pevalXorBitsTerm :: Term (WordN n) -> Term (WordN n) -> Term (WordN n)
pevalXorBitsTerm = Term (WordN n) -> Term (WordN n) -> Term (WordN n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultXorBitsTerm
pevalComplementBitsTerm :: Term (WordN n) -> Term (WordN n)
pevalComplementBitsTerm = Term (WordN n) -> Term (WordN n)
forall a.
(Bits a, SupportedPrim a, PEvalBitwiseTerm a) =>
Term a -> Term a
pevalDefaultComplementBitsTerm
withSbvBitwiseTermConstraint :: forall r. (Bits (SBVType (WordN n)) => r) -> r
withSbvBitwiseTermConstraint Bits (SBVType (WordN n)) => r
r = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(WordN n) r
Bits (SBVType (WordN n)) => r
(PrimConstraint (WordN n), SMTDefinable (SBVType (WordN n)),
Mergeable (SBVType (WordN n)), Typeable (SBVType (WordN n))) =>
r
r
instance (KnownNat n, 1 <= n) => PEvalBitwiseTerm (IntN n) where
pevalAndBitsTerm :: Term (IntN n) -> Term (IntN n) -> Term (IntN n)
pevalAndBitsTerm = Term (IntN n) -> Term (IntN n) -> Term (IntN n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultAndBitsTerm
pevalOrBitsTerm :: Term (IntN n) -> Term (IntN n) -> Term (IntN n)
pevalOrBitsTerm = Term (IntN n) -> Term (IntN n) -> Term (IntN n)
forall (bv :: Natural -> *) (m :: Natural).
(KnownNat m, 1 <= m,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultOrBitsTerm
pevalXorBitsTerm :: Term (IntN n) -> Term (IntN n) -> Term (IntN n)
pevalXorBitsTerm = Term (IntN n) -> Term (IntN n) -> Term (IntN n)
forall (bv :: Natural -> *) (m :: Natural).
(forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n),
PEvalBVTerm bv, KnownNat m, 1 <= m) =>
Term (bv m) -> Term (bv m) -> Term (bv m)
pevalDefaultXorBitsTerm
pevalComplementBitsTerm :: Term (IntN n) -> Term (IntN n)
pevalComplementBitsTerm = Term (IntN n) -> Term (IntN n)
forall a.
(Bits a, SupportedPrim a, PEvalBitwiseTerm a) =>
Term a -> Term a
pevalDefaultComplementBitsTerm
withSbvBitwiseTermConstraint :: forall r. (Bits (SBVType (IntN n)) => r) -> r
withSbvBitwiseTermConstraint Bits (SBVType (IntN n)) => r
r = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(IntN n) r
Bits (SBVType (IntN n)) => r
(PrimConstraint (IntN n), SMTDefinable (SBVType (IntN n)),
Mergeable (SBVType (IntN n)), Typeable (SBVType (IntN n))) =>
r
r
pevalDefaultBVSelectTerm ::
forall (bv2 :: Nat -> Type) bv n ix w p q.
( KnownNat n,
KnownNat ix,
KnownNat w,
1 <= n,
1 <= w,
ix + w <= n,
PEvalBVTerm bv,
forall x. (KnownNat x, 1 <= x) => PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2,
Typeable bv,
SupportedPrim (bv w),
SupportedPrim (bv2 n)
) =>
p ix ->
q w ->
Term (bv n) ->
Term (bv w)
pevalDefaultBVSelectTerm :: forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm p ix
ix q w
w =
PartialRuleUnary (bv n) (bv w)
-> TotalRuleUnary (bv n) (bv w) -> TotalRuleUnary (bv n) (bv w)
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce (forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
1 <= n, 1 <= w, (ix + w) <= n, PEvalBVTerm bv, PEvalBVTerm bv2,
Typeable bv, SupportedPrim (bv w), SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Maybe (Term (bv w))
doPevalDefaultBVSelectTerm @bv2 p ix
ix q w
w) (p ix -> q w -> TotalRuleUnary (bv n) (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
bvSelectTerm p ix
ix q w
w)
unsafePevalBVSelectTerm ::
forall bv n ix w.
(PEvalBVTerm bv) =>
NatRepr n ->
NatRepr ix ->
NatRepr w ->
Term (bv n) ->
Term (bv w)
unsafePevalBVSelectTerm :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr n
n NatRepr ix
ix NatRepr w
w Term (bv n)
term =
NatRepr n -> (KnownNat n => Term (bv w)) -> Term (bv w)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr n
n ((KnownNat n => Term (bv w)) -> Term (bv w))
-> (KnownNat n => Term (bv w)) -> Term (bv w)
forall a b. (a -> b) -> a -> b
$
NatRepr ix -> (KnownNat ix => Term (bv w)) -> Term (bv w)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr ix
ix ((KnownNat ix => Term (bv w)) -> Term (bv w))
-> (KnownNat ix => Term (bv w)) -> Term (bv w)
forall a b. (a -> b) -> a -> b
$
NatRepr w -> (KnownNat w => Term (bv w)) -> Term (bv w)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr w
w ((KnownNat w => Term (bv w)) -> Term (bv w))
-> (KnownNat w => Term (bv w)) -> Term (bv w)
forall a b. (a -> b) -> a -> b
$
case ( forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @n,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @w,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @(ix + w) @n
) of
(LeqProof 1 n
LeqProof, LeqProof 1 w
LeqProof, LeqProof (ix + w) n
LeqProof) -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm NatRepr ix
ix NatRepr w
w Term (bv n)
term
doPevalDefaultBVSelectTerm ::
forall (bv2 :: Nat -> Type) bv n ix w p q.
( KnownNat n,
KnownNat ix,
KnownNat w,
forall x. (KnownNat x, 1 <= x) => PEvalBitCastTerm (bv2 x) (bv x),
1 <= n,
1 <= w,
ix + w <= n,
PEvalBVTerm bv,
PEvalBVTerm bv2,
Typeable bv,
SupportedPrim (bv w),
SupportedPrim (bv2 n)
) =>
p ix ->
q w ->
Term (bv n) ->
Maybe (Term (bv w))
doPevalDefaultBVSelectTerm :: forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
1 <= n, 1 <= w, (ix + w) <= n, PEvalBVTerm bv, PEvalBVTerm bv2,
Typeable bv, SupportedPrim (bv w), SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Maybe (Term (bv w))
doPevalDefaultBVSelectTerm p ix
_ q w
_ Term (bv n)
rhs
| Maybe (ix :~: 0) -> Bool
forall a. Maybe a -> Bool
isJust (Proxy ix -> Proxy 0 -> Maybe (ix :~: 0)
forall (a :: Natural) (b :: Natural) (proxy1 :: Natural -> *)
(proxy2 :: Natural -> *).
(KnownNat a, KnownNat b) =>
proxy1 a -> proxy2 b -> Maybe (a :~: b)
sameNat (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @0))
Bool -> Bool -> Bool
&& Maybe (w :~: n) -> Bool
forall a. Maybe a -> Bool
isJust (Proxy w -> Proxy n -> Maybe (w :~: n)
forall (a :: Natural) (b :: Natural) (proxy1 :: Natural -> *)
(proxy2 :: Natural -> *).
(KnownNat a, KnownNat b) =>
proxy1 a -> proxy2 b -> Maybe (a :~: b)
sameNat (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n)) =
Term (bv n) -> Maybe (Term (bv n))
forall a. a -> Maybe a
Just Term (bv n)
rhs Maybe (Term (bv n))
-> (Term (bv n) -> Maybe (Term (bv w))) -> Maybe (Term (bv w))
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Term (bv n) -> Maybe (Term (bv w))
forall a b. Typeable b => Term a -> Maybe (Term b)
castTerm
doPevalDefaultBVSelectTerm p ix
ix q w
w (ConTerm bv n
b) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ bv w -> Term (bv w)
forall t. SupportedPrim t => t -> Term t
conTerm (bv w -> Term (bv w)) -> bv w -> Term (bv w)
forall a b. (a -> b) -> a -> b
$ p ix -> q w -> bv n -> bv w
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> bv n -> bv w
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(SizedBV bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> bv n -> bv w
sizedBVSelect p ix
ix q w
w bv n
b
doPevalDefaultBVSelectTerm p ix
ix q w
w (BitCastTerm (DynTerm (Term (bv2 n)
b :: Term (bv2 n)))) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ Term (bv2 w) -> Term (bv w)
forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm (Term (bv2 w) -> Term (bv w)) -> Term (bv2 w) -> Term (bv w)
forall a b. (a -> b) -> a -> b
$ p ix -> q w -> Term (bv2 n) -> Term (bv2 w)
forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (bv2 n) -> Term (bv2 w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
1 <= w, (ix + w) <= n) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalBVSelectTerm p ix
ix q w
w Term (bv2 n)
b
doPevalDefaultBVSelectTerm p ix
ix q w
w (AddNumTerm Term (bv n)
t1 Term (bv n)
t2)
| forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @ix p ix
ix Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
0 =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
Term (bv w) -> Term (bv w) -> Term (bv w)
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> Term t
AddNumTerm
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t1)
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t2)
doPevalDefaultBVSelectTerm p ix
ix q w
w (MulNumTerm Term (bv n)
t1 Term (bv n)
t2)
| forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @ix p ix
ix Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
0 =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
Term (bv w) -> Term (bv w) -> Term (bv w)
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> Term t
MulNumTerm
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t1)
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t2)
doPevalDefaultBVSelectTerm p ix
ix q w
w (AndBitsTerm Term (bv n)
t1 Term (bv n)
t2) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
Term (bv w) -> Term (bv w) -> Term (bv w)
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
AndBitsTerm
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t1)
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t2)
doPevalDefaultBVSelectTerm p ix
ix q w
w (OrBitsTerm Term (bv n)
t1 Term (bv n)
t2) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
Term (bv w) -> Term (bv w) -> Term (bv w)
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
OrBitsTerm
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t1)
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t2)
doPevalDefaultBVSelectTerm p ix
ix q w
w (XorBitsTerm Term (bv n)
t1 Term (bv n)
t2) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
Term (bv w) -> Term (bv w) -> Term (bv w)
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> Term t
XorBitsTerm
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t1)
(forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @bv2 @bv p ix
ix q w
w Term (bv n)
t2)
doPevalDefaultBVSelectTerm
p ix
pix
q w
pw
(BVConcatTerm (Term (bv l)
b1 :: Term (bv n1)) (Term (bv r)
b2 :: Term (bv n2)))
| Natural
ix Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
w Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
<= Natural
n2 = Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ NatRepr r -> NatRepr ix -> NatRepr w -> Term (bv r) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr r
n2Repr NatRepr ix
ixRepr NatRepr w
wRepr Term (bv r)
b2
| Natural
ix Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
>= Natural
n2 =
case Natural -> SomeNatRepr
mkNatRepr (Natural
ix Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
n2) of
SomeNatRepr NatRepr n
ixpn2Repr ->
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ NatRepr l -> NatRepr n -> NatRepr w -> Term (bv l) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr l
n1Repr NatRepr n
ixpn2Repr NatRepr w
wRepr Term (bv l)
b1
| Bool
otherwise =
case (Natural -> SomeNatRepr
mkNatRepr (Natural
w Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
ix Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
n2), Natural -> SomeNatRepr
mkNatRepr (Natural
n2 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
ix)) of
(SomeNatRepr NatRepr n
wixpn2Repr, SomeNatRepr NatRepr n
n2pixRepr) ->
let b1Part :: Term (bv n)
b1Part =
NatRepr l -> NatRepr 0 -> NatRepr n -> Term (bv l) -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr l
n1Repr (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @0) NatRepr n
wixpn2Repr Term (bv l)
b1
b2Part :: Term (bv n)
b2Part = NatRepr r -> NatRepr ix -> NatRepr n -> Term (bv r) -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr r
n2Repr NatRepr ix
ixRepr NatRepr n
n2pixRepr Term (bv r)
b2
in Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
NatRepr n
-> NatRepr n
-> NatRepr w
-> Term (bv n)
-> Term (bv n)
-> Term (bv w)
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
PEvalBVTerm bv =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafePevalBVConcatTerm
NatRepr n
wixpn2Repr
NatRepr n
n2pixRepr
NatRepr w
wRepr
Term (bv n)
b1Part
Term (bv n)
b2Part
where
ixRepr :: NatRepr ix
ixRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ix
wRepr :: NatRepr w
wRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @w
n1Repr :: NatRepr l
n1Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n1
n2Repr :: NatRepr r
n2Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n2
ix :: Natural
ix = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @ix p ix
pix
w :: Natural
w = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @w q w
pw
n2 :: Natural
n2 = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @n2 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n2)
doPevalDefaultBVSelectTerm
p ix
_
q w
_
(BVSelectTerm (Proxy ix
_ :: proxy ix1) Proxy w
_ (Term (bv n)
b :: Term (bv n1))) =
Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$
NatRepr n
-> NatRepr (ix + ix) -> NatRepr w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n1)
(NatRepr ix -> NatRepr ix -> NatRepr (ix + ix)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ix) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ix1))
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @w)
Term (bv n)
b
doPevalDefaultBVSelectTerm
p ix
pix
q w
pw
(BVExtendTerm Bool
signed Proxy r
_ (Term (bv l)
b :: Term (bv n1)))
| Natural
ix Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
w Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
<= Natural
n1 = Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ NatRepr l -> NatRepr ix -> NatRepr w -> Term (bv l) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr l
n1Repr NatRepr ix
ixRepr NatRepr w
wRepr Term (bv l)
b
| Natural
ix Natural -> Natural -> Bool
forall a. Ord a => a -> a -> Bool
< Natural
n1 =
case Natural -> SomeNatRepr
mkNatRepr (Natural
n1 Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
ix) of
SomeNatRepr NatRepr n
n1pixRepr ->
let bPart :: Term (bv n)
bPart = NatRepr l -> NatRepr ix -> NatRepr n -> Term (bv l) -> Term (bv n)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr l
n1Repr NatRepr ix
ixRepr NatRepr n
n1pixRepr Term (bv l)
b
in Term (bv w) -> Maybe (Term (bv w))
forall a. a -> Maybe a
Just (Term (bv w) -> Maybe (Term (bv w)))
-> Term (bv w) -> Maybe (Term (bv w))
forall a b. (a -> b) -> a -> b
$ NatRepr n -> NatRepr w -> Bool -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
PEvalBVTerm bv =>
NatRepr l -> NatRepr r -> Bool -> Term (bv l) -> Term (bv r)
unsafePevalBVExtendTerm NatRepr n
n1pixRepr NatRepr w
wRepr Bool
signed Term (bv n)
bPart
| Bool
otherwise = Maybe (Term (bv w))
forall a. Maybe a
Nothing
where
ixRepr :: NatRepr ix
ixRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ix
wRepr :: NatRepr w
wRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @w
n1Repr :: NatRepr l
n1Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n1
ix :: Natural
ix = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @ix p ix
pix
w :: Natural
w = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @w q w
pw
n1 :: Natural
n1 = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @n1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n1)
doPevalDefaultBVSelectTerm p ix
_ q w
_ Term (bv n)
_ = Maybe (Term (bv w))
forall a. Maybe a
Nothing
pevalDefaultBVExtendTerm ::
forall proxy l r bv.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
Typeable bv,
forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n)
) =>
Bool ->
proxy r ->
Term (bv l) ->
Term (bv r)
pevalDefaultBVExtendTerm :: forall (proxy :: Natural -> *) (l :: Natural) (r :: Natural)
(bv :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
Typeable bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalDefaultBVExtendTerm Bool
signed proxy r
p =
PartialRuleUnary (bv l) (bv r)
-> TotalRuleUnary (bv l) (bv r) -> TotalRuleUnary (bv l) (bv r)
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce (Bool -> proxy r -> PartialRuleUnary (bv l) (bv r)
forall (proxy :: Natural -> *) (l :: Natural) (r :: Natural)
(bv :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
Typeable bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Bool -> proxy r -> Term (bv l) -> Maybe (Term (bv r))
doPevalDefaultBVExtendTerm Bool
signed proxy r
p) (Bool -> proxy r -> TotalRuleUnary (bv l) (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
signed proxy r
p)
unsafePevalBVExtendTerm ::
forall bv l r.
(PEvalBVTerm bv) =>
NatRepr l ->
NatRepr r ->
Bool ->
Term (bv l) ->
Term (bv r)
unsafePevalBVExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
PEvalBVTerm bv =>
NatRepr l -> NatRepr r -> Bool -> Term (bv l) -> Term (bv r)
unsafePevalBVExtendTerm NatRepr l
lRepr NatRepr r
rRepr Bool
signed Term (bv l)
v =
case (forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @l, forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @r, forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @l @r) of
(LeqProof 1 l
LeqProof, LeqProof 1 r
LeqProof, LeqProof l r
LeqProof) ->
NatRepr l -> (KnownNat l => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr l
lRepr ((KnownNat l => Term (bv r)) -> Term (bv r))
-> (KnownNat l => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
NatRepr r -> (KnownNat r => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr r
rRepr ((KnownNat r => Term (bv r)) -> Term (bv r))
-> (KnownNat r => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
Bool -> Proxy r -> Term (bv l) -> Term (bv r)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
signed (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
doPevalDefaultBVExtendTerm ::
forall proxy l r bv.
( PEvalBVTerm bv,
KnownNat l,
KnownNat r,
1 <= l,
1 <= r,
l <= r,
Typeable bv,
forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n)
) =>
Bool ->
proxy r ->
Term (bv l) ->
Maybe (Term (bv r))
doPevalDefaultBVExtendTerm :: forall (proxy :: Natural -> *) (l :: Natural) (r :: Natural)
(bv :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
Typeable bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Bool -> proxy r -> Term (bv l) -> Maybe (Term (bv r))
doPevalDefaultBVExtendTerm Bool
signed proxy r
p (ConTerm bv l
b) =
Term (bv r) -> Maybe (Term (bv r))
forall a. a -> Maybe a
Just (Term (bv r) -> Maybe (Term (bv r)))
-> Term (bv r) -> Maybe (Term (bv r))
forall a b. (a -> b) -> a -> b
$ bv r -> Term (bv r)
forall t. SupportedPrim t => t -> Term t
conTerm (bv r -> Term (bv r)) -> bv r -> Term (bv r)
forall a b. (a -> b) -> a -> b
$ if Bool
signed then proxy r -> bv l -> bv r
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, KnownNat r, l <= r) =>
proxy r -> bv l -> bv r
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, KnownNat r, l <= r) =>
proxy r -> bv l -> bv r
sizedBVSext proxy r
p bv l
b else proxy r -> bv l -> bv r
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, KnownNat r, l <= r) =>
proxy r -> bv l -> bv r
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, KnownNat r, l <= r) =>
proxy r -> bv l -> bv r
sizedBVZext proxy r
p bv l
b
doPevalDefaultBVExtendTerm Bool
_ proxy r
_ Term (bv l)
b
| Maybe (l :~: r) -> Bool
forall a. Maybe a -> Bool
isJust (Maybe (l :~: r) -> Bool) -> Maybe (l :~: r) -> Bool
forall a b. (a -> b) -> a -> b
$ Proxy l -> Proxy r -> Maybe (l :~: r)
forall (a :: Natural) (b :: Natural) (proxy1 :: Natural -> *)
(proxy2 :: Natural -> *).
(KnownNat a, KnownNat b) =>
proxy1 a -> proxy2 b -> Maybe (a :~: b)
sameNat (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) =
Term (bv l) -> Maybe (Term (bv l))
forall a. a -> Maybe a
Just Term (bv l)
b Maybe (Term (bv l))
-> (Term (bv l) -> Maybe (Term (bv r))) -> Maybe (Term (bv r))
forall a b. Maybe a -> (a -> Maybe b) -> Maybe b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Term (bv l) -> Maybe (Term (bv r))
forall a b. Typeable b => Term a -> Maybe (Term b)
castTerm
doPevalDefaultBVExtendTerm Bool
False proxy r
pr Term (bv l)
b =
case (Natural -> SomePositiveNatRepr
mkPositiveNatRepr (Natural -> SomePositiveNatRepr) -> Natural -> SomePositiveNatRepr
forall a b. (a -> b) -> a -> b
$ Natural
r Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
l) of
SomePositiveNatRepr (NatRepr n
rplRepr :: NatRepr lpr) ->
Term (bv r) -> Maybe (Term (bv r))
forall a. a -> Maybe a
Just (Term (bv r) -> Maybe (Term (bv r)))
-> Term (bv r) -> Maybe (Term (bv r))
forall a b. (a -> b) -> a -> b
$
NatRepr n
-> NatRepr l
-> NatRepr r
-> Term (bv n)
-> Term (bv l)
-> Term (bv r)
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
PEvalBVTerm bv =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafePevalBVConcatTerm
NatRepr n
rplRepr
NatRepr l
lRepr
NatRepr r
rRepr
(bv n -> Term (bv n)
forall t. SupportedPrim t => t -> Term t
conTerm (bv n -> Term (bv n)) -> bv n -> Term (bv n)
forall a b. (a -> b) -> a -> b
$ Integer -> bv n
forall a (n :: Natural).
(Integral a, KnownNat n, 1 <= n) =>
a -> bv n
forall (bv :: Natural -> *) a (n :: Natural).
(SizedBV bv, Integral a, KnownNat n, 1 <= n) =>
a -> bv n
sizedBVFromIntegral Integer
0)
Term (bv l)
b
where
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rRepr :: NatRepr r
rRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
l :: Natural
l = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @l (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l)
r :: Natural
r = forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal @r proxy r
pr
doPevalDefaultBVExtendTerm Bool
True proxy r
p (BVExtendTerm Bool
True Proxy r
_ (Term (bv l)
b :: Term (bv l1))) =
case forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @l1 @r of
LeqProof l r
LeqProof -> Term (bv r) -> Maybe (Term (bv r))
forall a. a -> Maybe a
Just (Term (bv r) -> Maybe (Term (bv r)))
-> Term (bv r) -> Maybe (Term (bv r))
forall a b. (a -> b) -> a -> b
$ Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
True proxy r
p Term (bv l)
b
doPevalDefaultBVExtendTerm Bool
_ proxy r
_ Term (bv l)
_ = Maybe (Term (bv r))
forall a. Maybe a
Nothing
pevalDefaultBVConcatTerm ::
forall bv a b.
( KnownNat a,
KnownNat b,
1 <= a,
1 <= b,
PEvalBVTerm bv,
forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n)
) =>
Term (bv a) ->
Term (bv b) ->
Term (bv (a + b))
pevalDefaultBVConcatTerm :: forall (bv :: Natural -> *) (a :: Natural) (b :: Natural).
(KnownNat a, KnownNat b, 1 <= a, 1 <= b, PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b))
pevalDefaultBVConcatTerm =
NatRepr (a + b)
-> (KnownNat (a + b) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b)))
-> Term (bv a)
-> Term (bv b)
-> Term (bv (a + b))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat (NatRepr a -> NatRepr b -> NatRepr (a + b)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @a) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @b)) ((KnownNat (a + b) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b)))
-> Term (bv a) -> Term (bv b) -> Term (bv (a + b)))
-> (KnownNat (a + b) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b)))
-> Term (bv a)
-> Term (bv b)
-> Term (bv (a + b))
forall a b. (a -> b) -> a -> b
$
case (forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(a + b)) of
LeqProof 1 (a + b)
LeqProof ->
PartialRuleBinary (bv a) (bv b) (bv (a + b))
-> (Term (bv a) -> Term (bv b) -> Term (bv (a + b)))
-> Term (bv a)
-> Term (bv b)
-> Term (bv (a + b))
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce PartialRuleBinary (bv a) (bv b) (bv (a + b))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l, 1 <= r,
1 <= (l + r), PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Term (bv l) -> Term (bv r) -> Maybe (Term (bv (l + r)))
doPevalDefaultBVConcatTerm Term (bv a) -> Term (bv b) -> Term (bv (a + b))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm
unsafeBVConcatTerm ::
forall bv n1 n2 r.
(PEvalBVTerm bv, forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n)) =>
NatRepr n1 ->
NatRepr n2 ->
NatRepr r ->
Term (bv n1) ->
Term (bv n2) ->
Term (bv r)
unsafeBVConcatTerm :: forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr n1
n1Repr NatRepr n2
n2Repr NatRepr r
rRepr Term (bv n1)
lhs Term (bv n2)
rhs =
case ( (n1 + n2) :~: r
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom :: (n1 + n2) :~: r,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @r,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @n1,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @n2
) of
((n1 + n2) :~: r
Refl, LeqProof 1 r
LeqProof, LeqProof 1 n1
LeqProof, LeqProof 1 n2
LeqProof) ->
NatRepr n1 -> (KnownNat n1 => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr n1
n1Repr ((KnownNat n1 => Term (bv r)) -> Term (bv r))
-> (KnownNat n1 => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
NatRepr n2 -> (KnownNat n2 => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr n2
n2Repr ((KnownNat n2 => Term (bv r)) -> Term (bv r))
-> (KnownNat n2 => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
NatRepr r -> (KnownNat r => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr r
rRepr ((KnownNat r => Term (bv r)) -> Term (bv r))
-> (KnownNat r => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
Term (bv n1) -> Term (bv n2) -> Term (bv (n1 + n2))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm Term (bv n1)
lhs Term (bv n2)
rhs
unsafePevalBVConcatTerm ::
forall bv n1 n2 r.
(PEvalBVTerm bv) =>
NatRepr n1 ->
NatRepr n2 ->
NatRepr r ->
Term (bv n1) ->
Term (bv n2) ->
Term (bv r)
unsafePevalBVConcatTerm :: forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
PEvalBVTerm bv =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafePevalBVConcatTerm NatRepr n1
n1Repr NatRepr n2
n2Repr NatRepr r
rRepr Term (bv n1)
lhs Term (bv n2)
rhs =
case ( (n1 + n2) :~: r
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom :: (n1 + n2) :~: r,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @r,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @n1,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @n2
) of
((n1 + n2) :~: r
Refl, LeqProof 1 r
LeqProof, LeqProof 1 n1
LeqProof, LeqProof 1 n2
LeqProof) ->
NatRepr n1 -> (KnownNat n1 => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr n1
n1Repr ((KnownNat n1 => Term (bv r)) -> Term (bv r))
-> (KnownNat n1 => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
NatRepr n2 -> (KnownNat n2 => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr n2
n2Repr ((KnownNat n2 => Term (bv r)) -> Term (bv r))
-> (KnownNat n2 => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
NatRepr r -> (KnownNat r => Term (bv r)) -> Term (bv r)
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr r
rRepr ((KnownNat r => Term (bv r)) -> Term (bv r))
-> (KnownNat r => Term (bv r)) -> Term (bv r)
forall a b. (a -> b) -> a -> b
$
Term (bv n1) -> Term (bv n2) -> Term (bv (n1 + n2))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm Term (bv n1)
lhs Term (bv n2)
rhs
doPevalDefaultBVConcatTerm ::
forall bv l r.
( KnownNat l,
KnownNat r,
KnownNat (l + r),
1 <= l,
1 <= r,
1 <= (l + r),
PEvalBVTerm bv,
forall n. (KnownNat n, 1 <= n) => SupportedPrim (bv n)
) =>
Term (bv l) ->
Term (bv r) ->
Maybe (Term (bv (l + r)))
doPevalDefaultBVConcatTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l, 1 <= r,
1 <= (l + r), PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Term (bv l) -> Term (bv r) -> Maybe (Term (bv (l + r)))
doPevalDefaultBVConcatTerm (ConTerm bv l
v) (ConTerm bv r
v') =
NatRepr (l + r)
-> (KnownNat (l + r) => Maybe (Term (bv (l + r))))
-> Maybe (Term (bv (l + r)))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat (NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r)) ((KnownNat (l + r) => Maybe (Term (bv (l + r))))
-> Maybe (Term (bv (l + r))))
-> (KnownNat (l + r) => Maybe (Term (bv (l + r))))
-> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$
bv (l + r) -> Term (bv (l + r))
forall t. SupportedPrim t => t -> Term t
conTerm (bv (l + r) -> Term (bv (l + r)))
-> bv (l + r) -> Term (bv (l + r))
forall a b. (a -> b) -> a -> b
$
bv l -> bv r -> bv (l + r)
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
sizedBVConcat bv l
v bv r
v'
doPevalDefaultBVConcatTerm
(ConTerm bv l
vl)
(BVConcatTerm (ConTerm (bv l
vrl :: bv rl)) (Term (bv r)
rr :: Term (bv rr))) =
case forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(l + rl) of
LeqProof 1 (l + l)
LeqProof ->
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$
NatRepr (l + l)
-> (KnownNat (l + l) => Term (bv (l + r))) -> Term (bv (l + r))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr (l + l)
lRlRepr ((KnownNat (l + l) => Term (bv (l + r))) -> Term (bv (l + r)))
-> (KnownNat (l + l) => Term (bv (l + r))) -> Term (bv (l + r))
forall a b. (a -> b) -> a -> b
$
NatRepr (l + l)
-> NatRepr r
-> NatRepr (l + r)
-> Term (bv (l + l))
-> Term (bv r)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm
NatRepr (l + l)
lRlRepr
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rr)
(NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r))
(bv (l + l) -> Term (bv (l + l))
forall t. SupportedPrim t => t -> Term t
conTerm (bv (l + l) -> Term (bv (l + l)))
-> bv (l + l) -> Term (bv (l + l))
forall a b. (a -> b) -> a -> b
$ bv l -> bv l -> bv (l + l)
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
sizedBVConcat bv l
vl bv l
vrl)
Term (bv r)
rr
where
lRlRepr :: NatRepr (l + l)
lRlRepr = NatRepr l -> NatRepr l -> NatRepr (l + l)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rl)
doPevalDefaultBVConcatTerm (ConTerm {}) (BVConcatTerm Term (bv l)
_ ConTerm {}) = Maybe (Term (bv (l + r)))
forall a. Maybe a
Nothing
doPevalDefaultBVConcatTerm
(BVConcatTerm (ll :: Term (bv l)
ll@ConTerm {} :: Term (bv ll)) (Term (bv r)
lr :: Term (bv lr)))
Term (bv r)
r =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ NatRepr l
-> NatRepr (r + r)
-> NatRepr (l + r)
-> Term (bv l)
-> Term (bv (r + r))
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr l
llRepr NatRepr (r + r)
lrRRepr NatRepr (l + r)
lRRepr Term (bv l)
ll Term (bv (r + r))
rhs
where
llRepr :: NatRepr l
llRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ll
lrRepr :: NatRepr r
lrRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @lr
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rRepr :: NatRepr r
rRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
lrRRepr :: NatRepr (r + r)
lrRRepr = NatRepr r -> NatRepr r -> NatRepr (r + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr r
lrRepr NatRepr r
rRepr
lRRepr :: NatRepr (l + r)
lRRepr = NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr r
rRepr
rhs :: Term (bv (lr + r))
rhs :: Term (bv (r + r))
rhs = NatRepr r
-> NatRepr r
-> NatRepr (r + r)
-> Term (bv r)
-> Term (bv r)
-> Term (bv (r + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
PEvalBVTerm bv =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafePevalBVConcatTerm NatRepr r
lrRepr NatRepr r
rRepr NatRepr (r + r)
lrRRepr Term (bv r)
lr Term (bv r)
r
doPevalDefaultBVConcatTerm
Term (bv l)
l
( BVConcatTerm
(rl :: Term (bv l)
rl@ConTerm {} :: Term (bv rl))
(BVConcatTerm (Term (bv l)
rrl :: Term (bv rrl)) (rrr :: Term (bv r)
rrr@ConTerm {} :: Term (bv rrr)))
) =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ NatRepr ((l + l) + l)
-> NatRepr r
-> NatRepr (l + r)
-> Term (bv ((l + l) + l))
-> Term (bv r)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr ((l + l) + l)
lRlRrlRepr NatRepr r
rrrRepr NatRepr (l + r)
lRRepr Term (bv ((l + l) + l))
lRlRrl Term (bv r)
rrr
where
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rlRepr :: NatRepr l
rlRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rl
rrlRepr :: NatRepr l
rrlRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rrl
rrrRepr :: NatRepr r
rrrRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rrr
lRlRepr :: NatRepr (l + l)
lRlRepr = NatRepr l -> NatRepr l -> NatRepr (l + l)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr l
rlRepr
rRepr :: NatRepr r
rRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
lRRepr :: NatRepr (l + r)
lRRepr = NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr r
rRepr
lRl :: Term (bv (l + l))
lRl = NatRepr l
-> NatRepr l
-> NatRepr (l + l)
-> Term (bv l)
-> Term (bv l)
-> Term (bv (l + l))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
PEvalBVTerm bv =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafePevalBVConcatTerm NatRepr l
lRepr NatRepr l
rlRepr NatRepr (l + l)
lRlRepr Term (bv l)
l Term (bv l)
rl
lRlRrlRepr :: NatRepr ((l + l) + l)
lRlRrlRepr = NatRepr (l + l) -> NatRepr l -> NatRepr ((l + l) + l)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr (l + l)
lRlRepr NatRepr l
rrlRepr
lRlRrl :: Term (bv ((l + l) + l))
lRlRrl = NatRepr (l + l)
-> NatRepr l
-> NatRepr ((l + l) + l)
-> Term (bv (l + l))
-> Term (bv l)
-> Term (bv ((l + l) + l))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr (l + l)
lRlRepr NatRepr l
rrlRepr NatRepr ((l + l) + l)
lRlRrlRepr Term (bv (l + l))
lRl Term (bv l)
rrl
doPevalDefaultBVConcatTerm
(BVConcatTerm (Term (bv l)
ll :: Term (bv ll)) ((ConTerm bv r
vlr) :: Term (bv lr)))
(ConTerm bv r
vr) =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ NatRepr l
-> NatRepr (r + r)
-> NatRepr (l + r)
-> Term (bv l)
-> Term (bv (r + r))
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr l
llRepr NatRepr (r + r)
lrRRepr NatRepr (l + r)
lRRepr Term (bv l)
ll Term (bv (r + r))
rhs
where
llRepr :: NatRepr l
llRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ll
lrRepr :: NatRepr r
lrRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @lr
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rRepr :: NatRepr r
rRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
lrRRepr :: NatRepr (r + r)
lrRRepr = NatRepr r -> NatRepr r -> NatRepr (r + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr r
lrRepr NatRepr r
rRepr
lRRepr :: NatRepr (l + r)
lRRepr = NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr r
rRepr
rhs :: Term (bv (lr + r))
rhs :: Term (bv (r + r))
rhs = case forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(lr + r) of
LeqProof 1 (r + r)
LeqProof ->
NatRepr (r + r)
-> (KnownNat (r + r) => Term (bv (r + r))) -> Term (bv (r + r))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr (r + r)
lrRRepr ((KnownNat (r + r) => Term (bv (r + r))) -> Term (bv (r + r)))
-> (KnownNat (r + r) => Term (bv (r + r))) -> Term (bv (r + r))
forall a b. (a -> b) -> a -> b
$ bv (r + r) -> Term (bv (r + r))
forall t. SupportedPrim t => t -> Term t
conTerm (bv (r + r) -> Term (bv (r + r)))
-> bv (r + r) -> Term (bv (r + r))
forall a b. (a -> b) -> a -> b
$ bv r -> bv r -> bv (r + r)
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
sizedBVConcat bv r
vlr bv r
vr
doPevalDefaultBVConcatTerm
(BVConcatTerm (Term (bv l)
ll :: Term (bv ll)) ((ConTerm bv r
vlr) :: Term (bv lr)))
(BVConcatTerm ((ConTerm bv l
vrl) :: Term (bv rl)) (Term (bv r)
rr :: Term (bv rr))) =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ NatRepr l
-> NatRepr ((r + l) + r)
-> NatRepr (l + r)
-> Term (bv l)
-> Term (bv ((r + l) + r))
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr l
llRepr NatRepr ((r + l) + r)
lrRlRrRepr NatRepr (l + r)
lRRepr Term (bv l)
ll Term (bv ((r + l) + r))
lrRlRR
where
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rRepr :: NatRepr r
rRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r
llRepr :: NatRepr l
llRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ll
lrRepr :: NatRepr r
lrRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @lr
rlRepr :: NatRepr l
rlRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rl
rrRepr :: NatRepr r
rrRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rr
lRRepr :: NatRepr (l + r)
lRRepr = NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr r
rRepr
lrRlRepr :: NatRepr (lr + rl)
lrRlRepr :: NatRepr (r + l)
lrRlRepr = NatRepr r -> NatRepr l -> NatRepr (r + l)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr r
lrRepr NatRepr l
rlRepr
lrRlRrRepr :: NatRepr ((lr + rl) + rr)
lrRlRrRepr :: NatRepr ((r + l) + r)
lrRlRrRepr = NatRepr (r + l) -> NatRepr r -> NatRepr ((r + l) + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr (r + l)
lrRlRepr NatRepr r
rrRepr
lrRl :: Term (bv (lr + rl))
lrRl :: Term (bv (r + l))
lrRl = case forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(lr + rl) of
LeqProof 1 (r + l)
LeqProof -> NatRepr (r + l)
-> (KnownNat (r + l) => Term (bv (r + l))) -> Term (bv (r + l))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat NatRepr (r + l)
lrRlRepr ((KnownNat (r + l) => Term (bv (r + l))) -> Term (bv (r + l)))
-> (KnownNat (r + l) => Term (bv (r + l))) -> Term (bv (r + l))
forall a b. (a -> b) -> a -> b
$ bv (r + l) -> Term (bv (r + l))
forall t. SupportedPrim t => t -> Term t
conTerm (bv (r + l) -> Term (bv (r + l)))
-> bv (r + l) -> Term (bv (r + l))
forall a b. (a -> b) -> a -> b
$ bv r -> bv l -> bv (r + l)
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(SizedBV bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
bv l -> bv r -> bv (l + r)
sizedBVConcat bv r
vlr bv l
vrl
lrRlRR :: Term (bv ((lr + rl) + rr))
lrRlRR :: Term (bv ((r + l) + r))
lrRlRR = NatRepr (r + l)
-> NatRepr r
-> NatRepr ((r + l) + r)
-> Term (bv (r + l))
-> Term (bv r)
-> Term (bv ((r + l) + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr (r + l)
lrRlRepr NatRepr r
rrRepr NatRepr ((r + l) + r)
lrRlRrRepr Term (bv (r + l))
lrRl Term (bv r)
rr
doPevalDefaultBVConcatTerm
Term (bv l)
l
(BVConcatTerm (Term (bv l)
rl :: Term (bv rl)) (rr :: Term (bv r)
rr@ConTerm {} :: Term (bv rr))) =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$
NatRepr (l + l)
-> NatRepr r
-> NatRepr (l + r)
-> Term (bv (l + l))
-> Term (bv r)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm
NatRepr (l + l)
lRlRepr
(forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rr)
(NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r))
Term (bv (l + l))
lhs
Term (bv r)
rr
where
lRepr :: NatRepr l
lRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l
rlRepr :: NatRepr l
rlRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @rl
lRlRepr :: NatRepr (l + l)
lRlRepr = NatRepr l -> NatRepr l -> NatRepr (l + l)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr l
lRepr NatRepr l
rlRepr
lhs :: Term (bv (l + rl))
lhs :: Term (bv (l + l))
lhs = NatRepr l
-> NatRepr l
-> NatRepr (l + l)
-> Term (bv l)
-> Term (bv l)
-> Term (bv (l + l))
forall (bv :: Natural -> *) (n1 :: Natural) (n2 :: Natural)
(r :: Natural).
(PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
NatRepr n1
-> NatRepr n2
-> NatRepr r
-> Term (bv n1)
-> Term (bv n2)
-> Term (bv r)
unsafeBVConcatTerm NatRepr l
lRepr NatRepr l
rlRepr NatRepr (l + l)
lRlRepr Term (bv l)
l Term (bv l)
rl
doPevalDefaultBVConcatTerm
(BVSelectTerm Proxy ix
ix0 (Proxy w
_ :: p w0) (Term (bv n)
bv0 :: Term (bv n)))
(BVSelectTerm (Proxy ix
ix1 :: p ix1) (Proxy w
w1 :: p w1) (DynTerm (Term (bv n)
bv1 :: Term (bv n))))
| Natural
ix1v Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Natural
w1v Natural -> Natural -> Bool
forall a. Eq a => a -> a -> Bool
== Natural
ix0v Bool -> Bool -> Bool
&& Term (bv n)
bv0 Term (bv n) -> Term (bv n) -> Bool
forall a. Eq a => a -> a -> Bool
== Term (bv n)
bv1 =
Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a. a -> Maybe a
Just (Term (bv (l + r)) -> Maybe (Term (bv (l + r))))
-> Term (bv (l + r)) -> Maybe (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ NatRepr n
-> NatRepr ix
-> NatRepr (l + r)
-> Term (bv n)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
(w :: Natural).
PEvalBVTerm bv =>
NatRepr n -> NatRepr ix -> NatRepr w -> Term (bv n) -> Term (bv w)
unsafePevalBVSelectTerm NatRepr n
nRepr NatRepr ix
ix1Repr (NatRepr w -> NatRepr w -> NatRepr (w + w)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat NatRepr w
w0Repr NatRepr w
w1Repr) Term (bv n)
bv0
where
nRepr :: NatRepr n
nRepr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @n
w1v :: Natural
w1v = Proxy w -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy w
w1
ix0v :: Natural
ix0v = Proxy ix -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy ix
ix0
ix1v :: Natural
ix1v = Proxy ix -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal Proxy ix
ix1
ix1Repr :: NatRepr ix
ix1Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @ix1
w0Repr :: NatRepr w
w0Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @w0
w1Repr :: NatRepr w
w1Repr = forall (n :: Natural). KnownNat n => NatRepr n
natRepr @w1
doPevalDefaultBVConcatTerm Term (bv l)
_ Term (bv r)
_ = Maybe (Term (bv (l + r)))
forall a. Maybe a
Nothing
instance PEvalBVTerm WordN where
pevalBVSelectTerm :: forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (WordN n) -> Term (WordN w)
pevalBVSelectTerm = forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @IntN
pevalBVConcatTerm :: forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (WordN l) -> Term (WordN r) -> Term (WordN (l + r))
pevalBVConcatTerm = Term (WordN l) -> Term (WordN r) -> Term (WordN (l + r))
forall (bv :: Natural -> *) (a :: Natural) (b :: Natural).
(KnownNat a, KnownNat b, 1 <= a, 1 <= b, PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b))
pevalDefaultBVConcatTerm
pevalBVExtendTerm :: forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (WordN l) -> Term (WordN r)
pevalBVExtendTerm = Bool -> proxy r -> Term (WordN l) -> Term (WordN r)
forall (proxy :: Natural -> *) (l :: Natural) (r :: Natural)
(bv :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
Typeable bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalDefaultBVExtendTerm
sbvBVConcatTerm :: forall (l :: Natural) (r :: Natural) (p1 :: Natural -> *)
(p2 :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
p1 l
-> p2 r
-> SBVType (WordN l)
-> SBVType (WordN r)
-> SBVType (WordN (l + r))
sbvBVConcatTerm p1 l
pl p2 r
pr SBVType (WordN l)
l SBVType (WordN r)
r =
p1 l
-> (BVIsNonZero l => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 p1 l
pl ((BVIsNonZero l => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r)))
-> (BVIsNonZero l => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r))
forall a b. (a -> b) -> a -> b
$
p2 r
-> (BVIsNonZero r => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 p2 r
pr ((BVIsNonZero r => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r)))
-> (BVIsNonZero r => SBVType (WordN (l + r)))
-> SBVType (WordN (l + r))
forall a b. (a -> b) -> a -> b
$
SBV (WordN l)
SBVType (WordN l)
l SBV (WordN l) -> SBV (WordN r) -> SBV (WordN (l + r))
forall (n :: Natural) (bv :: Natural -> *) (m :: Natural).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m)) =>
SBV (bv n) -> SBV (bv m) -> SBV (bv (n + m))
SBV.# SBV (WordN r)
SBVType (WordN r)
r
sbvBVSelectTerm :: forall (ix :: Natural) (w :: Natural) (n :: Natural)
(p1 :: Natural -> *) (p2 :: Natural -> *) (p3 :: Natural -> *).
(KnownNat ix, KnownNat w, KnownNat n, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p1 ix -> p2 w -> p3 n -> SBVType (WordN n) -> SBVType (WordN w)
sbvBVSelectTerm (p1 ix
pix :: p0 ix) (p2 w
pw :: p1 w) (p3 n
pn :: p2 n) SBVType (WordN n)
bv =
Proxy n
-> (BVIsNonZero n => SBVType (WordN w)) -> SBVType (WordN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) ((BVIsNonZero n => SBVType (WordN w)) -> SBVType (WordN w))
-> (BVIsNonZero n => SBVType (WordN w)) -> SBVType (WordN w)
forall a b. (a -> b) -> a -> b
$
Proxy w
-> (BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w))
-> (BVIsNonZero w => SBVType (WordN w)) -> SBVType (WordN w)
forall a b. (a -> b) -> a -> b
$
p1 ix -> p2 w -> p3 n -> SBV (WordN n) -> SBV (WordN w)
forall (ix :: Natural) (w :: Natural) (n :: Natural)
(bv :: Natural -> *) (p1 :: Natural -> *) (p2 :: Natural -> *)
(p3 :: Natural -> *).
(KnownNat ix, KnownNat w, KnownNat n, 1 <= n, 1 <= w,
(ix + w) <= n, SymVal (bv n)) =>
p1 ix -> p2 w -> p3 n -> SBV (bv n) -> SBV (bv w)
sbvDefaultBVSelectTerm p1 ix
pix p2 w
pw p3 n
pn SBV (WordN n)
SBVType (WordN n)
bv
sbvBVExtendTerm :: forall (l :: Natural) (r :: Natural) (p1 :: Natural -> *)
(p2 :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
p1 l -> p2 r -> Bool -> SBVType (WordN l) -> SBVType (WordN r)
sbvBVExtendTerm (p1 l
_ :: p0 l) (p2 r
_ :: p1 r) Bool
signed SBVType (WordN l)
bv =
KnownProof (r - l)
-> (KnownNat (r - l) => SBVType (WordN r)) -> SBVType (WordN r)
forall (n :: Natural) r. KnownProof n -> (KnownNat n => r) -> r
withKnownProof
(forall (n :: Natural). Natural -> KnownProof n
unsafeKnownProof @(r - l) (Proxy r -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Proxy l -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l)))
((KnownNat (r - l) => SBVType (WordN r)) -> SBVType (WordN r))
-> (KnownNat (r - l) => SBVType (WordN r)) -> SBVType (WordN r)
forall a b. (a -> b) -> a -> b
$ case (forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @(l + 1) @r, forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(r - l)) of
(LeqProof (l + 1) r
LeqProof, LeqProof 1 (r - l)
LeqProof) ->
Proxy r
-> (BVIsNonZero r => SBVType (WordN r)) -> SBVType (WordN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) ((BVIsNonZero r => SBVType (WordN r)) -> SBVType (WordN r))
-> (BVIsNonZero r => SBVType (WordN r)) -> SBVType (WordN r)
forall a b. (a -> b) -> a -> b
$
Proxy l
-> (BVIsNonZero l => SBVType (WordN r)) -> SBVType (WordN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l) ((BVIsNonZero l => SBVType (WordN r)) -> SBVType (WordN r))
-> (BVIsNonZero l => SBVType (WordN r)) -> SBVType (WordN r)
forall a b. (a -> b) -> a -> b
$
Proxy (r - l)
-> (BVIsNonZero (r - l) => SBVType (WordN r)) -> SBVType (WordN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @(r - l)) ((BVIsNonZero (r - l) => SBVType (WordN r)) -> SBVType (WordN r))
-> (BVIsNonZero (r - l) => SBVType (WordN r)) -> SBVType (WordN r)
forall a b. (a -> b) -> a -> b
$
if Bool
signed then SBV (WordN l) -> SBV (WordN r)
forall (n :: Natural) (m :: Natural) (bv :: Natural -> *).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SFiniteBits (bv n),
SIntegral (bv (m - n)), BVIsNonZero (m - n)) =>
SBV (bv n) -> SBV (bv m)
SBV.signExtend SBV (WordN l)
SBVType (WordN l)
bv else SBV (WordN l) -> SBV (WordN r)
forall (n :: Natural) (m :: Natural) (bv :: Natural -> *).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SIntegral (bv (m - n)),
BVIsNonZero (m - n)) =>
SBV (bv n) -> SBV (bv m)
SBV.zeroExtend SBV (WordN l)
SBVType (WordN l)
bv
instance PEvalBVTerm IntN where
pevalBVSelectTerm :: forall (n :: Natural) (ix :: Natural) (w :: Natural)
(p :: Natural -> *) (q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p ix -> q w -> Term (IntN n) -> Term (IntN w)
pevalBVSelectTerm = forall (bv2 :: Natural -> *) (bv :: Natural -> *) (n :: Natural)
(ix :: Natural) (w :: Natural) (p :: Natural -> *)
(q :: Natural -> *).
(KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w,
(ix + w) <= n, PEvalBVTerm bv,
forall (x :: Natural).
(KnownNat x, 1 <= x) =>
PEvalBitCastTerm (bv2 x) (bv x),
PEvalBVTerm bv2, Typeable bv, SupportedPrim (bv w),
SupportedPrim (bv2 n)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
pevalDefaultBVSelectTerm @WordN
pevalBVConcatTerm :: forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (IntN l) -> Term (IntN r) -> Term (IntN (l + r))
pevalBVConcatTerm = Term (IntN l) -> Term (IntN r) -> Term (IntN (l + r))
forall (bv :: Natural -> *) (a :: Natural) (b :: Natural).
(KnownNat a, KnownNat b, 1 <= a, 1 <= b, PEvalBVTerm bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Term (bv a) -> Term (bv b) -> Term (bv (a + b))
pevalDefaultBVConcatTerm
pevalBVExtendTerm :: forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (IntN l) -> Term (IntN r)
pevalBVExtendTerm = Bool -> proxy r -> Term (IntN l) -> Term (IntN r)
forall (proxy :: Natural -> *) (l :: Natural) (r :: Natural)
(bv :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
Typeable bv,
forall (n :: Natural).
(KnownNat n, 1 <= n) =>
SupportedPrim (bv n)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalDefaultBVExtendTerm
sbvBVConcatTerm :: forall (l :: Natural) (r :: Natural) (p1 :: Natural -> *)
(p2 :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
p1 l
-> p2 r
-> SBVType (IntN l)
-> SBVType (IntN r)
-> SBVType (IntN (l + r))
sbvBVConcatTerm (p1 l
pl :: p l) (p2 r
pr :: q r) SBVType (IntN l)
l SBVType (IntN r)
r =
p1 l
-> (BVIsNonZero l => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 p1 l
pl ((BVIsNonZero l => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r)))
-> (BVIsNonZero l => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall a b. (a -> b) -> a -> b
$
p2 r
-> (BVIsNonZero r => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 p2 r
pr ((BVIsNonZero r => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r)))
-> (BVIsNonZero r => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall a b. (a -> b) -> a -> b
$
NatRepr (l + r)
-> (KnownNat (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall (n :: Natural) r. NatRepr n -> (KnownNat n => r) -> r
withKnownNat (NatRepr l -> NatRepr r -> NatRepr (l + r)
forall (m :: Natural) (n :: Natural).
NatRepr m -> NatRepr n -> NatRepr (m + n)
addNat (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @l) (forall (n :: Natural). KnownNat n => NatRepr n
natRepr @r)) ((KnownNat (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r)))
-> (KnownNat (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall a b. (a -> b) -> a -> b
$
case forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(l + r) of
LeqProof 1 (l + r)
LeqProof ->
Proxy (l + r)
-> (BVIsNonZero (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @(l + r)) ((BVIsNonZero (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r)))
-> (BVIsNonZero (l + r) => SBVType (IntN (l + r)))
-> SBVType (IntN (l + r))
forall a b. (a -> b) -> a -> b
$
forall a b. PEvalBitCastTerm a b => SBVType a -> SBVType b
sbvBitCast @(WordN (l + r)) @(IntN (l + r)) (SBVType (WordN (l + r)) -> SBVType (IntN (l + r)))
-> SBVType (WordN (l + r)) -> SBVType (IntN (l + r))
forall a b. (a -> b) -> a -> b
$
(forall a b. PEvalBitCastTerm a b => SBVType a -> SBVType b
sbvBitCast @(IntN l) @(WordN l) SBVType (IntN l)
l)
SBV (WordN l) -> SBV (WordN r) -> SBV (WordN (l + r))
forall (n :: Natural) (bv :: Natural -> *) (m :: Natural).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m)) =>
SBV (bv n) -> SBV (bv m) -> SBV (bv (n + m))
SBV.# (forall a b. PEvalBitCastTerm a b => SBVType a -> SBVType b
sbvBitCast @(IntN r) @(WordN r) SBVType (IntN r)
r)
sbvBVSelectTerm :: forall (ix :: Natural) (w :: Natural) (n :: Natural)
(p1 :: Natural -> *) (p2 :: Natural -> *) (p3 :: Natural -> *).
(KnownNat ix, KnownNat w, KnownNat n, 1 <= n, 1 <= w,
(ix + w) <= n) =>
p1 ix -> p2 w -> p3 n -> SBVType (IntN n) -> SBVType (IntN w)
sbvBVSelectTerm (p1 ix
pix :: p0 ix) (p2 w
pw :: p1 w) (p3 n
pn :: p2 n) SBVType (IntN n)
bv =
Proxy n -> (BVIsNonZero n => SBVType (IntN w)) -> SBVType (IntN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) ((BVIsNonZero n => SBVType (IntN w)) -> SBVType (IntN w))
-> (BVIsNonZero n => SBVType (IntN w)) -> SBVType (IntN w)
forall a b. (a -> b) -> a -> b
$
Proxy w -> (BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w))
-> (BVIsNonZero w => SBVType (IntN w)) -> SBVType (IntN w)
forall a b. (a -> b) -> a -> b
$
p1 ix -> p2 w -> p3 n -> SBV (IntN n) -> SBV (IntN w)
forall (ix :: Natural) (w :: Natural) (n :: Natural)
(bv :: Natural -> *) (p1 :: Natural -> *) (p2 :: Natural -> *)
(p3 :: Natural -> *).
(KnownNat ix, KnownNat w, KnownNat n, 1 <= n, 1 <= w,
(ix + w) <= n, SymVal (bv n)) =>
p1 ix -> p2 w -> p3 n -> SBV (bv n) -> SBV (bv w)
sbvDefaultBVSelectTerm p1 ix
pix p2 w
pw p3 n
pn SBV (IntN n)
SBVType (IntN n)
bv
sbvBVExtendTerm :: forall (l :: Natural) (r :: Natural) (p1 :: Natural -> *)
(p2 :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
p1 l -> p2 r -> Bool -> SBVType (IntN l) -> SBVType (IntN r)
sbvBVExtendTerm (p1 l
_ :: p0 l) (p2 r
_ :: p1 r) Bool
signed SBVType (IntN l)
bv =
KnownProof (r - l)
-> (KnownNat (r - l) => SBVType (IntN r)) -> SBVType (IntN r)
forall (n :: Natural) r. KnownProof n -> (KnownNat n => r) -> r
withKnownProof
(forall (n :: Natural). Natural -> KnownProof n
unsafeKnownProof @(r - l) (Proxy r -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Proxy l -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l)))
((KnownNat (r - l) => SBVType (IntN r)) -> SBVType (IntN r))
-> (KnownNat (r - l) => SBVType (IntN r)) -> SBVType (IntN r)
forall a b. (a -> b) -> a -> b
$ case (forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @(l + 1) @r, forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @1 @(r - l)) of
(LeqProof (l + 1) r
LeqProof, LeqProof 1 (r - l)
LeqProof) ->
Proxy r -> (BVIsNonZero r => SBVType (IntN r)) -> SBVType (IntN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) ((BVIsNonZero r => SBVType (IntN r)) -> SBVType (IntN r))
-> (BVIsNonZero r => SBVType (IntN r)) -> SBVType (IntN r)
forall a b. (a -> b) -> a -> b
$
Proxy l -> (BVIsNonZero l => SBVType (IntN r)) -> SBVType (IntN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @l) ((BVIsNonZero l => SBVType (IntN r)) -> SBVType (IntN r))
-> (BVIsNonZero l => SBVType (IntN r)) -> SBVType (IntN r)
forall a b. (a -> b) -> a -> b
$
Proxy (r - l)
-> (BVIsNonZero (r - l) => SBVType (IntN r)) -> SBVType (IntN r)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @(r - l)) ((BVIsNonZero (r - l) => SBVType (IntN r)) -> SBVType (IntN r))
-> (BVIsNonZero (r - l) => SBVType (IntN r)) -> SBVType (IntN r)
forall a b. (a -> b) -> a -> b
$
if Bool
signed
then SBV (IntN l) -> SBV (IntN r)
forall (n :: Natural) (m :: Natural) (bv :: Natural -> *).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SFiniteBits (bv n),
SIntegral (bv (m - n)), BVIsNonZero (m - n)) =>
SBV (bv n) -> SBV (bv m)
SBV.signExtend SBV (IntN l)
SBVType (IntN l)
bv
else
SBV (WordN r) -> SBV (IntN r)
forall a b.
(Integral a, HasKind a, Num a, SymVal a, HasKind b, Num b,
SymVal b) =>
SBV a -> SBV b
SBV.sFromIntegral
( SBV (WordN l) -> SBV (WordN r)
forall (n :: Natural) (m :: Natural) (bv :: Natural -> *).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat m,
BVIsNonZero m, SymVal (bv m), (n + 1) <= m, SIntegral (bv (m - n)),
BVIsNonZero (m - n)) =>
SBV (bv n) -> SBV (bv m)
SBV.zeroExtend
(SBV (IntN l) -> SBV (WordN l)
forall a b.
(Integral a, HasKind a, Num a, SymVal a, HasKind b, Num b,
SymVal b) =>
SBV a -> SBV b
SBV.sFromIntegral SBV (IntN l)
SBVType (IntN l)
bv :: SBV.SBV (SBV.WordN l)) ::
SBV.SBV (SBV.WordN r)
)
sbvDefaultBVSelectTerm ::
( KnownNat ix,
KnownNat w,
KnownNat n,
1 <= n,
1 <= w,
(ix + w) <= n,
SBV.SymVal (bv n)
) =>
p1 ix ->
p2 w ->
p3 n ->
SBV.SBV (bv n) ->
SBV.SBV (bv w)
sbvDefaultBVSelectTerm :: forall (ix :: Natural) (w :: Natural) (n :: Natural)
(bv :: Natural -> *) (p1 :: Natural -> *) (p2 :: Natural -> *)
(p3 :: Natural -> *).
(KnownNat ix, KnownNat w, KnownNat n, 1 <= n, 1 <= w,
(ix + w) <= n, SymVal (bv n)) =>
p1 ix -> p2 w -> p3 n -> SBV (bv n) -> SBV (bv w)
sbvDefaultBVSelectTerm (p1 ix
_ :: p0 ix) (p2 w
_ :: p1 w) (p3 n
_ :: p2 n) SBV (bv n)
bv =
KnownProof ((w + ix) - 1)
-> (KnownNat ((w + ix) - 1) => SBV (bv w)) -> SBV (bv w)
forall (n :: Natural) r. KnownProof n -> (KnownNat n => r) -> r
withKnownProof
( forall (n :: Natural). Natural -> KnownProof n
unsafeKnownProof @(w + ix - 1)
(Proxy w -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
+ Proxy ix -> Natural
forall (n :: Natural) (proxy :: Natural -> *).
KnownNat n =>
proxy n -> Natural
natVal (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) Natural -> Natural -> Natural
forall a. Num a => a -> a -> a
- Natural
1)
)
((KnownNat ((w + ix) - 1) => SBV (bv w)) -> SBV (bv w))
-> (KnownNat ((w + ix) - 1) => SBV (bv w)) -> SBV (bv w)
forall a b. (a -> b) -> a -> b
$ case ( forall (a :: Natural) (b :: Natural). a :~: b
forall {k} (a :: k) (b :: k). a :~: b
unsafeAxiom @(w + ix - 1 - ix + 1) @w,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @(((w + ix) - 1) + 1) @n,
forall (m :: Natural) (n :: Natural). LeqProof m n
unsafeLeqProof @ix @(w + ix - 1)
) of
(((((w + ix) - 1) - ix) + 1) :~: w
Refl, LeqProof (((w + ix) - 1) + 1) n
LeqProof, LeqProof ix ((w + ix) - 1)
LeqProof) ->
Proxy n -> (BVIsNonZero n => SBV (bv w)) -> SBV (bv w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) ((BVIsNonZero n => SBV (bv w)) -> SBV (bv w))
-> (BVIsNonZero n => SBV (bv w)) -> SBV (bv w)
forall a b. (a -> b) -> a -> b
$
Proxy w -> (BVIsNonZero w => SBV (bv w)) -> SBV (bv w)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) ((BVIsNonZero w => SBV (bv w)) -> SBV (bv w))
-> (BVIsNonZero w => SBV (bv w)) -> SBV (bv w)
forall a b. (a -> b) -> a -> b
$
Proxy ((w + ix) - 1)
-> Proxy ix -> SBV (bv n) -> SBV (bv ((((w + ix) - 1) - ix) + 1))
forall (i :: Natural) (j :: Natural) (n :: Natural)
(bv :: Natural -> *) (proxy :: Natural -> *).
(KnownNat n, BVIsNonZero n, SymVal (bv n), KnownNat i, KnownNat j,
(i + 1) <= n, j <= i, BVIsNonZero ((i - j) + 1)) =>
proxy i -> proxy j -> SBV (bv n) -> SBV (bv ((i - j) + 1))
SBV.bvExtract (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @(w + ix - 1)) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) SBV (bv n)
bv
doPevalBitCastSameType ::
forall x b. (SupportedPrim b) => Term x -> Maybe (Term b)
doPevalBitCastSameType :: forall x b. SupportedPrim b => Term x -> Maybe (Term b)
doPevalBitCastSameType (BitCastTerm (DynTerm (Term b
b :: Term b))) = Term b -> Maybe (Term b)
forall a. a -> Maybe a
Just Term b
b
doPevalBitCastSameType (BitCastTerm Term a
x) = Term a -> Maybe (Term b)
forall x b. SupportedPrim b => Term x -> Maybe (Term b)
doPevalBitCastSameType Term a
x
doPevalBitCastSameType Term x
_ = Maybe (Term b)
forall a. Maybe a
Nothing
doPevalBitCast :: (PEvalBitCastTerm a b, SupportedPrim b) => Term a -> Maybe (Term b)
doPevalBitCast :: forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Maybe (Term b)
doPevalBitCast (ConTerm a
v) = Term b -> Maybe (Term b)
forall a. a -> Maybe a
Just (Term b -> Maybe (Term b)) -> Term b -> Maybe (Term b)
forall a b. (a -> b) -> a -> b
$ b -> Term b
forall t. SupportedPrim t => t -> Term t
conTerm (b -> Term b) -> b -> Term b
forall a b. (a -> b) -> a -> b
$ a -> b
forall from to. BitCast from to => from -> to
bitCast a
v
doPevalBitCast Term a
t = Term a -> Maybe (Term b)
forall x b. SupportedPrim b => Term x -> Maybe (Term b)
doPevalBitCastSameType Term a
t
instance (KnownNat n, 1 <= n) => PEvalBitCastTerm (WordN n) (IntN n) where
pevalBitCastTerm :: Term (WordN n) -> Term (IntN n)
pevalBitCastTerm = PartialRuleUnary (WordN n) (IntN n)
-> (Term (WordN n) -> Term (IntN n))
-> Term (WordN n)
-> Term (IntN n)
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary (WordN n) (IntN n)
doPevalBitCastBV Term (WordN n) -> Term (IntN n)
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm
where
doPevalBitCastBV :: Term (WordN n) -> Maybe (Term (IntN n))
doPevalBitCastBV :: PartialRuleUnary (WordN n) (IntN n)
doPevalBitCastBV
(BVConcatTerm (Term (WordN l)
l :: Term (WordN l)) (Term (WordN r)
r :: Term (WordN r))) =
Term (IntN n) -> Maybe (Term (IntN n))
forall a. a -> Maybe a
Just (Term (IntN n) -> Maybe (Term (IntN n)))
-> Term (IntN n) -> Maybe (Term (IntN n))
forall a b. (a -> b) -> a -> b
$
Term (IntN l) -> Term (IntN r) -> Term (IntN (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (IntN l) -> Term (IntN r) -> Term (IntN (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(WordN l) @(IntN l) Term (WordN l)
l)
(forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(WordN r) @(IntN r) Term (WordN r)
r)
doPevalBitCastBV (BVExtendTerm Bool
signed Proxy r
pr (Term (WordN l)
b :: Term (WordN l))) =
Term (IntN n) -> Maybe (Term (IntN n))
forall a. a -> Maybe a
Just (Term (IntN n) -> Maybe (Term (IntN n)))
-> Term (IntN n) -> Maybe (Term (IntN n))
forall a b. (a -> b) -> a -> b
$
Bool -> Proxy n -> Term (IntN l) -> Term (IntN n)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (IntN l) -> Term (IntN r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
signed Proxy n
Proxy r
pr (Term (IntN l) -> Term (IntN n)) -> Term (IntN l) -> Term (IntN n)
forall a b. (a -> b) -> a -> b
$
forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(WordN l) @(IntN l) Term (WordN l)
b
doPevalBitCastBV Term (WordN n)
v = PartialRuleUnary (WordN n) (IntN n)
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Maybe (Term b)
doPevalBitCast Term (WordN n)
v
sbvBitCast :: SBVType (WordN n) -> SBVType (IntN n)
sbvBitCast = Proxy n
-> (BVIsNonZero n => SBV (WordN n) -> SBV (IntN n))
-> SBV (WordN n)
-> SBV (IntN n)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) BVIsNonZero n => SBV (WordN n) -> SBV (IntN n)
SBV (WordN n) -> SBV (IntN n)
forall a b.
(Integral a, HasKind a, Num a, SymVal a, HasKind b, Num b,
SymVal b) =>
SBV a -> SBV b
SBV.sFromIntegral
instance (KnownNat n, 1 <= n) => PEvalBitCastTerm (IntN n) (WordN n) where
pevalBitCastTerm :: Term (IntN n) -> Term (WordN n)
pevalBitCastTerm = PartialRuleUnary (IntN n) (WordN n)
-> (Term (IntN n) -> Term (WordN n))
-> Term (IntN n)
-> Term (WordN n)
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary (IntN n) (WordN n)
doPevalBitCastBV Term (IntN n) -> Term (WordN n)
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm
where
doPevalBitCastBV :: Term (IntN n) -> Maybe (Term (WordN n))
doPevalBitCastBV :: PartialRuleUnary (IntN n) (WordN n)
doPevalBitCastBV
(BVConcatTerm (Term (IntN l)
l :: Term (IntN l)) (Term (IntN r)
r :: Term (IntN r))) =
Term (WordN n) -> Maybe (Term (WordN n))
forall a. a -> Maybe a
Just (Term (WordN n) -> Maybe (Term (WordN n)))
-> Term (WordN n) -> Maybe (Term (WordN n))
forall a b. (a -> b) -> a -> b
$
Term (WordN l) -> Term (WordN r) -> Term (WordN (l + r))
forall (l :: Natural) (r :: Natural).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (WordN l) -> Term (WordN r) -> Term (WordN (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
pevalBVConcatTerm
(forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(IntN l) @(WordN l) Term (IntN l)
l)
(forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(IntN r) @(WordN r) Term (IntN r)
r)
doPevalBitCastBV (BVExtendTerm Bool
signed Proxy r
pr (Term (IntN l)
b :: Term (IntN l))) =
Term (WordN n) -> Maybe (Term (WordN n))
forall a. a -> Maybe a
Just (Term (WordN n) -> Maybe (Term (WordN n)))
-> Term (WordN n) -> Maybe (Term (WordN n))
forall a b. (a -> b) -> a -> b
$
Bool -> Proxy n -> Term (WordN l) -> Term (WordN n)
forall (l :: Natural) (r :: Natural) (proxy :: Natural -> *).
(KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (WordN l) -> Term (WordN r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
(proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
pevalBVExtendTerm Bool
signed Proxy n
Proxy r
pr (Term (WordN l) -> Term (WordN n))
-> Term (WordN l) -> Term (WordN n)
forall a b. (a -> b) -> a -> b
$
forall a b. PEvalBitCastTerm a b => Term a -> Term b
pevalBitCastTerm @(IntN l) @(WordN l) Term (IntN l)
b
doPevalBitCastBV Term (IntN n)
v = PartialRuleUnary (IntN n) (WordN n)
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Maybe (Term b)
doPevalBitCast Term (IntN n)
v
sbvBitCast :: SBVType (IntN n) -> SBVType (WordN n)
sbvBitCast = Proxy n
-> (BVIsNonZero n => SBV (IntN n) -> SBV (WordN n))
-> SBV (IntN n)
-> SBV (WordN n)
forall (w :: Natural) r (proxy :: Natural -> *).
(1 <= w) =>
proxy w -> (BVIsNonZero w => r) -> r
bvIsNonZeroFromGEq1 (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @n) BVIsNonZero n => SBV (IntN n) -> SBV (WordN n)
SBV (IntN n) -> SBV (WordN n)
forall a b.
(Integral a, HasKind a, Num a, SymVal a, HasKind b, Num b,
SymVal b) =>
SBV a -> SBV b
SBV.sFromIntegral
pevalDefaultAddNumTerm :: (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultAddNumTerm :: forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultAddNumTerm l :: Term a
l@Term a
SupportedTerm Term a
r =
PartialRuleBinary a a a
-> TotalRuleBinary a a a -> TotalRuleBinary a a a
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce
PartialRuleBinary a a a
forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTerm
(\Term a
a Term a
b -> Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
normalizeAddNum (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ TotalRuleBinary a a a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm Term a
a Term a
b)
Term a
l
Term a
r
doPevalDefaultAddNumTerm ::
(PEvalNumTerm a, Eq a) => Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTerm :: forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTerm (ConTerm a
a) (ConTerm a
b) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
a a -> a -> a
forall a. Num a => a -> a -> a
+ a
b
doPevalDefaultAddNumTerm l :: Term a
l@(ConTerm a
a) Term a
b = case (a
a, Term a
b) of
(a
0, Term a
k) -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
k
(a
l1, AddNumTerm (ConTerm a
j) Term a
k) ->
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
l1 a -> a -> a
forall a. Num a => a -> a -> a
+ a
j) Term a
k
(a, Term a)
_ -> Term a -> Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTermNoCon Term a
l Term a
b
doPevalDefaultAddNumTerm Term a
a r :: Term a
r@(ConTerm {}) = Term a -> Term a -> Maybe (Term a)
forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTerm Term a
r Term a
a
doPevalDefaultAddNumTerm Term a
l Term a
r = Term a -> Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTermNoCon Term a
l Term a
r
doPevalDefaultAddNumTermNoCon ::
(PEvalNumTerm a) => Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTermNoCon :: forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultAddNumTermNoCon (AddNumTerm i :: Term a
i@ConTerm {} Term a
j) Term a
k =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
i (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
j Term a
k
doPevalDefaultAddNumTermNoCon Term a
i (AddNumTerm j :: Term a
j@ConTerm {} Term a
k) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
j (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
i Term a
k
doPevalDefaultAddNumTermNoCon (NegNumTerm Term a
i) (NegNumTerm Term a
j) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
i Term a
j
doPevalDefaultAddNumTermNoCon
(MulNumTerm (ConTerm a
i) Term a
j)
(MulNumTerm (ConTerm a
k) Term a
l)
| Term a
j Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
l = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
i a -> a -> a
forall a. Num a => a -> a -> a
+ a
k) Term a
j
doPevalDefaultAddNumTermNoCon
(MulNumTerm i :: Term a
i@ConTerm {} Term a
j)
(MulNumTerm k :: Term a
k@(ConTerm {}) Term a
l)
| Term a
i Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
k = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
i (Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
j Term a
l)
doPevalDefaultAddNumTermNoCon Term a
_ Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
normalizeAddNum :: (PEvalNumTerm a) => Term a -> Term a
normalizeAddNum :: forall t. PEvalNumTerm t => Term t -> Term t
normalizeAddNum (AddNumTerm Term a
l r :: Term a
r@(ConTerm {})) = Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm Term a
r Term a
l
normalizeAddNum Term a
v = Term a
v
pevalDefaultNegNumTerm :: (PEvalNumTerm a, Eq a) => Term a -> Term a
pevalDefaultNegNumTerm :: forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a
pevalDefaultNegNumTerm l :: Term a
l@Term a
SupportedTerm =
PartialRuleUnary a a -> TotalRuleUnary a a -> TotalRuleUnary a a
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary a a
forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalDefaultNegNumTerm TotalRuleUnary a a
forall t. PEvalNumTerm t => Term t -> Term t
negNumTerm Term a
l
doPevalDefaultNegNumTerm :: (PEvalNumTerm a) => Term a -> Maybe (Term a)
doPevalDefaultNegNumTerm :: forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalDefaultNegNumTerm (ConTerm a
a) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ -a
a
doPevalDefaultNegNumTerm (NegNumTerm Term a
v) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
v
doPevalDefaultNegNumTerm (AddNumTerm (ConTerm a
l) Term a
r) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalSubNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ -a
l) Term a
r
doPevalDefaultNegNumTerm (AddNumTerm (NegNumTerm Term a
l) Term a
r) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
l (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm Term a
r)
doPevalDefaultNegNumTerm (AddNumTerm Term a
l (NegNumTerm Term a
r)) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm Term a
l) Term a
r
doPevalDefaultNegNumTerm (MulNumTerm (ConTerm a
l) Term a
r) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ -a
l) Term a
r
doPevalDefaultNegNumTerm (MulNumTerm (NegNumTerm {}) Term a
_) =
String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
doPevalDefaultNegNumTerm (MulNumTerm Term a
_ (NegNumTerm {})) =
String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
doPevalDefaultNegNumTerm (AddNumTerm Term a
_ ConTerm {}) = String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
doPevalDefaultNegNumTerm Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
pevalDefaultMulNumTerm :: (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultMulNumTerm :: forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultMulNumTerm l :: Term a
l@Term a
SupportedTerm Term a
r =
PartialRuleBinary a a a
-> TotalRuleBinary a a a -> TotalRuleBinary a a a
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce
PartialRuleBinary a a a
forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTerm
(\Term a
a Term a
b -> Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
normalizeMulNum (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ TotalRuleBinary a a a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm Term a
a Term a
b)
Term a
l
Term a
r
normalizeMulNum :: (PEvalNumTerm a) => Term a -> Term a
normalizeMulNum :: forall t. PEvalNumTerm t => Term t -> Term t
normalizeMulNum (MulNumTerm Term a
l r :: Term a
r@(ConTerm {})) = Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm Term a
r Term a
l
normalizeMulNum Term a
v = Term a
v
doPevalDefaultMulNumTerm ::
(PEvalNumTerm a, Eq a) => Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTerm :: forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTerm (ConTerm a
a) (ConTerm a
b) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
a a -> a -> a
forall a. Num a => a -> a -> a
* a
b
doPevalDefaultMulNumTerm l :: Term a
l@(ConTerm a
a) Term a
b = case (a
a, Term a
b) of
(a
0, Term a
_) -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm a
0
(a
1, Term a
k) -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
k
(-1, Term a
k) -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm Term a
k
(a
l1, MulNumTerm (ConTerm a
j) Term a
k) ->
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
l1 a -> a -> a
forall a. Num a => a -> a -> a
* a
j) Term a
k
(a
l1, AddNumTerm (ConTerm a
j) Term a
k) ->
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
l1 a -> a -> a
forall a. Num a => a -> a -> a
* a
j) (Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm a
l1) Term a
k)
(a
l1, NegNumTerm Term a
j) -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ -a
l1) Term a
j)
(a
_, MulNumTerm Term a
_ ConTerm {}) -> String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
(a
_, AddNumTerm Term a
_ ConTerm {}) -> String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
(a, Term a)
_ -> Term a -> Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTermNoCon Term a
l Term a
b
doPevalDefaultMulNumTerm Term a
a r :: Term a
r@(ConTerm {}) = Term a -> Term a -> Maybe (Term a)
forall a.
(PEvalNumTerm a, Eq a) =>
Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTerm Term a
r Term a
a
doPevalDefaultMulNumTerm Term a
l Term a
r = Term a -> Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTermNoCon Term a
l Term a
r
doPevalDefaultMulNumTermNoCon ::
(PEvalNumTerm a) => Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTermNoCon :: forall a. PEvalNumTerm a => Term a -> Term a -> Maybe (Term a)
doPevalDefaultMulNumTermNoCon (MulNumTerm i :: Term a
i@ConTerm {} Term a
j) Term a
k =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
i (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
j Term a
k
doPevalDefaultMulNumTermNoCon Term a
i (MulNumTerm j :: Term a
j@ConTerm {} Term a
k) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
j (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
i Term a
k
doPevalDefaultMulNumTermNoCon (NegNumTerm Term a
i) Term a
j =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
i Term a
j
doPevalDefaultMulNumTermNoCon Term a
i (NegNumTerm Term a
j) =
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
i Term a
j
doPevalDefaultMulNumTermNoCon Term a
i j :: Term a
j@ConTerm {} = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm Term a
j Term a
i
doPevalDefaultMulNumTermNoCon (MulNumTerm Term a
_ ConTerm {}) Term a
_ =
String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
doPevalDefaultMulNumTermNoCon Term a
_ (MulNumTerm Term a
_ ConTerm {}) =
String -> Maybe (Term a)
forall a. HasCallStack => String -> a
error String
"Should not happen"
doPevalDefaultMulNumTermNoCon Term a
_ Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
pevalBitsAbsNumTerm :: (PEvalNumTerm a, Bits a) => Term a -> Term a
pevalBitsAbsNumTerm :: forall a. (PEvalNumTerm a, Bits a) => Term a -> Term a
pevalBitsAbsNumTerm l :: Term a
l@Term a
SupportedTerm =
PartialRuleUnary a a -> TotalRuleUnary a a -> TotalRuleUnary a a
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary a a
forall a. (PEvalNumTerm a, Bits a) => Term a -> Maybe (Term a)
doPevalBitsAbsNumTerm TotalRuleUnary a a
forall t. PEvalNumTerm t => Term t -> Term t
absNumTerm Term a
l
doPevalGeneralAbsNumTerm :: (PEvalNumTerm a) => Term a -> Maybe (Term a)
doPevalGeneralAbsNumTerm :: forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralAbsNumTerm (ConTerm a
a) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a -> a
forall a. Num a => a -> a
abs a
a
doPevalGeneralAbsNumTerm (NegNumTerm Term a
v) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalAbsNumTerm Term a
v
doPevalGeneralAbsNumTerm t :: Term a
t@(AbsNumTerm {}) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
t
doPevalGeneralAbsNumTerm Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
doPevalBitsAbsNumTerm ::
forall a. (PEvalNumTerm a, Bits a) => Term a -> Maybe (Term a)
doPevalBitsAbsNumTerm :: forall a. (PEvalNumTerm a, Bits a) => Term a -> Maybe (Term a)
doPevalBitsAbsNumTerm Term a
t =
[Maybe (Term a)] -> Maybe (Term a)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ if a -> Bool
forall a. Bits a => a -> Bool
isSigned (a
forall a. HasCallStack => a
undefined :: a) then Maybe (Term a)
forall a. Maybe a
Nothing else Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
t,
Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralAbsNumTerm Term a
t
]
doPevalNoOverflowAbsNumTerm :: (PEvalNumTerm a) => Term a -> Maybe (Term a)
doPevalNoOverflowAbsNumTerm :: forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalNoOverflowAbsNumTerm Term a
t =
[Maybe (Term a)] -> Maybe (Term a)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralAbsNumTerm Term a
t,
case Term a
t of
MulNumTerm Term a
l Term a
r ->
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalAbsNumTerm Term a
l) (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalAbsNumTerm Term a
r
Term a
_ -> Maybe (Term a)
forall a. Maybe a
Nothing
]
pevalGeneralSignumNumTerm :: (PEvalNumTerm a) => Term a -> Term a
pevalGeneralSignumNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
pevalGeneralSignumNumTerm l :: Term a
l@Term a
SupportedTerm =
PartialRuleUnary a a -> TotalRuleUnary a a -> TotalRuleUnary a a
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary a a
forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralSignumNumTerm TotalRuleUnary a a
forall t. PEvalNumTerm t => Term t -> Term t
signumNumTerm Term a
l
doPevalGeneralSignumNumTerm :: (PEvalNumTerm a) => Term a -> Maybe (Term a)
doPevalGeneralSignumNumTerm :: forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralSignumNumTerm (ConTerm a
a) = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a -> a
forall a. Num a => a -> a
signum a
a
doPevalGeneralSignumNumTerm Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing
doPevalNoOverflowSignumNumTerm :: (PEvalNumTerm a) => Term a -> Maybe (Term a)
doPevalNoOverflowSignumNumTerm :: forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalNoOverflowSignumNumTerm Term a
t =
[Maybe (Term a)] -> Maybe (Term a)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
[ Term a -> Maybe (Term a)
forall a. PEvalNumTerm a => Term a -> Maybe (Term a)
doPevalGeneralSignumNumTerm Term a
t,
case Term a
t of
NegNumTerm Term a
v -> Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$ Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalSignumNumTerm Term a
v
MulNumTerm Term a
l Term a
r ->
Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$
Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalMulNumTerm (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalSignumNumTerm Term a
l) (Term a -> Term a) -> Term a -> Term a
forall a b. (a -> b) -> a -> b
$
Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalSignumNumTerm Term a
r
Term a
_ -> Maybe (Term a)
forall a. Maybe a
Nothing
]
instance (KnownNat n, 1 <= n) => PEvalNumTerm (WordN n) where
pevalAddNumTerm :: Term (WordN n) -> Term (WordN n) -> Term (WordN n)
pevalAddNumTerm = Term (WordN n) -> Term (WordN n) -> Term (WordN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultAddNumTerm
pevalNegNumTerm :: Term (WordN n) -> Term (WordN n)
pevalNegNumTerm = Term (WordN n) -> Term (WordN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a
pevalDefaultNegNumTerm
pevalMulNumTerm :: Term (WordN n) -> Term (WordN n) -> Term (WordN n)
pevalMulNumTerm = Term (WordN n) -> Term (WordN n) -> Term (WordN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultMulNumTerm
pevalAbsNumTerm :: Term (WordN n) -> Term (WordN n)
pevalAbsNumTerm = Term (WordN n) -> Term (WordN n)
forall a. (PEvalNumTerm a, Bits a) => Term a -> Term a
pevalBitsAbsNumTerm
pevalSignumNumTerm :: Term (WordN n) -> Term (WordN n)
pevalSignumNumTerm = Term (WordN n) -> Term (WordN n)
forall t. PEvalNumTerm t => Term t -> Term t
pevalGeneralSignumNumTerm
withSbvNumTermConstraint :: forall r. (Num (SBVType (WordN n)) => r) -> r
withSbvNumTermConstraint Num (SBVType (WordN n)) => r
r = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(WordN n) r
Num (SBVType (WordN n)) => r
(PrimConstraint (WordN n), SMTDefinable (SBVType (WordN n)),
Mergeable (SBVType (WordN n)), Typeable (SBVType (WordN n))) =>
r
r
instance (KnownNat n, 1 <= n) => PEvalNumTerm (IntN n) where
pevalAddNumTerm :: Term (IntN n) -> Term (IntN n) -> Term (IntN n)
pevalAddNumTerm = Term (IntN n) -> Term (IntN n) -> Term (IntN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultAddNumTerm
pevalNegNumTerm :: Term (IntN n) -> Term (IntN n)
pevalNegNumTerm = Term (IntN n) -> Term (IntN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a
pevalDefaultNegNumTerm
pevalMulNumTerm :: Term (IntN n) -> Term (IntN n) -> Term (IntN n)
pevalMulNumTerm = Term (IntN n) -> Term (IntN n) -> Term (IntN n)
forall a. (PEvalNumTerm a, Eq a) => Term a -> Term a -> Term a
pevalDefaultMulNumTerm
pevalAbsNumTerm :: Term (IntN n) -> Term (IntN n)
pevalAbsNumTerm = Term (IntN n) -> Term (IntN n)
forall a. (PEvalNumTerm a, Bits a) => Term a -> Term a
pevalBitsAbsNumTerm
pevalSignumNumTerm :: Term (IntN n) -> Term (IntN n)
pevalSignumNumTerm = Term (IntN n) -> Term (IntN n)
forall t. PEvalNumTerm t => Term t -> Term t
pevalGeneralSignumNumTerm
withSbvNumTermConstraint :: forall r. (Num (SBVType (IntN n)) => r) -> r
withSbvNumTermConstraint Num (SBVType (IntN n)) => r
r = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
Mergeable (SBVType t), Typeable (SBVType t)) =>
a)
-> a
withPrim @(IntN n) r
Num (SBVType (IntN n)) => r
(PrimConstraint (IntN n), SMTDefinable (SBVType (IntN n)),
Mergeable (SBVType (IntN n)), Typeable (SBVType (IntN n))) =>
r
r
type PartialFun a b = a -> Maybe b
type PartialRuleUnary a b = PartialFun (Term a) (Term b)
type TotalRuleUnary a b = Term a -> Term b
type PartialRuleBinary a b c = Term a -> PartialFun (Term b) (Term c)
type TotalRuleBinary a b c = Term a -> Term b -> Term c
totalize :: PartialFun a b -> (a -> b) -> a -> b
totalize :: forall a b. PartialFun a b -> (a -> b) -> a -> b
totalize PartialFun a b
partial a -> b
fallback a
a =
case PartialFun a b
partial a
a of
Just b
b -> b
b
Maybe b
Nothing -> a -> b
fallback a
a
totalize2 :: (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 :: forall a b c. (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 a -> PartialFun b c
partial a -> b -> c
fallback a
a b
b =
case a -> PartialFun b c
partial a
a b
b of
Just c
c -> c
c
Maybe c
Nothing -> a -> b -> c
fallback a
a b
b
class UnaryPartialStrategy tag a b | tag a -> b where
:: tag -> Term a -> Maybe a
constantHandler :: tag -> a -> Maybe (Term b)
nonConstantHandler :: tag -> Term a -> Maybe (Term b)
unaryPartial :: forall tag a b. (UnaryPartialStrategy tag a b) => tag -> PartialRuleUnary a b
unaryPartial :: forall tag a b.
UnaryPartialStrategy tag a b =>
tag -> PartialRuleUnary a b
unaryPartial tag
tag Term a
a = case tag -> Term a -> Maybe a
forall tag a b.
UnaryPartialStrategy tag a b =>
tag -> Term a -> Maybe a
extractor tag
tag Term a
a of
Maybe a
Nothing -> tag -> Term a -> Maybe (Term b)
forall tag a b.
UnaryPartialStrategy tag a b =>
tag -> PartialRuleUnary a b
nonConstantHandler tag
tag Term a
a
Just a
a' -> tag -> a -> Maybe (Term b)
forall tag a b.
UnaryPartialStrategy tag a b =>
tag -> a -> Maybe (Term b)
constantHandler tag
tag a
a'
class BinaryCommPartialStrategy tag a c | tag a -> c where
singleConstantHandler :: tag -> a -> Term a -> Maybe (Term c)
class BinaryPartialStrategy tag a b c | tag a b -> c where
:: tag -> Term a -> Maybe a
:: tag -> Term b -> Maybe b
allConstantHandler :: tag -> a -> b -> Maybe (Term c)
leftConstantHandler :: tag -> a -> Term b -> Maybe (Term c)
default leftConstantHandler :: (a ~ b, BinaryCommPartialStrategy tag a c) => tag -> a -> Term b -> Maybe (Term c)
leftConstantHandler = forall tag a c.
BinaryCommPartialStrategy tag a c =>
tag -> a -> Term a -> Maybe (Term c)
singleConstantHandler @tag @a
rightConstantHandler :: tag -> Term a -> b -> Maybe (Term c)
default rightConstantHandler :: (a ~ b, BinaryCommPartialStrategy tag a c) => tag -> Term a -> b -> Maybe (Term c)
rightConstantHandler tag
tag = (b -> Term a -> Maybe (Term c)) -> Term a -> b -> Maybe (Term c)
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((b -> Term a -> Maybe (Term c)) -> Term a -> b -> Maybe (Term c))
-> (b -> Term a -> Maybe (Term c)) -> Term a -> b -> Maybe (Term c)
forall a b. (a -> b) -> a -> b
$ forall tag a c.
BinaryCommPartialStrategy tag a c =>
tag -> a -> Term a -> Maybe (Term c)
singleConstantHandler @tag @a tag
tag
nonBinaryConstantHandler :: tag -> Term a -> Term b -> Maybe (Term c)
binaryPartial :: forall tag a b c. (BinaryPartialStrategy tag a b c) => tag -> PartialRuleBinary a b c
binaryPartial :: forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> PartialRuleBinary a b c
binaryPartial tag
tag Term a
a Term b
b = case (forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> Term a -> Maybe a
extractora @tag @a @b @c tag
tag Term a
a, forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> Term b -> Maybe b
extractorb @tag @a @b @c tag
tag Term b
b) of
(Maybe a
Nothing, Maybe b
Nothing) -> forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> PartialRuleBinary a b c
nonBinaryConstantHandler @tag @a @b @c tag
tag Term a
a Term b
b
(Just a
a', Maybe b
Nothing) ->
forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> a -> Term b -> Maybe (Term c)
leftConstantHandler @tag @a @b @c tag
tag a
a' Term b
b
Maybe (Term c) -> (() -> Maybe (Term c)) -> Maybe (Term c)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
`catchError` \()
_ -> forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> PartialRuleBinary a b c
nonBinaryConstantHandler @tag @a @b @c tag
tag Term a
a Term b
b
(Maybe a
Nothing, Just b
b') ->
forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> Term a -> b -> Maybe (Term c)
rightConstantHandler @tag @a @b @c tag
tag Term a
a b
b'
Maybe (Term c) -> (() -> Maybe (Term c)) -> Maybe (Term c)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
`catchError` \()
_ -> forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> PartialRuleBinary a b c
nonBinaryConstantHandler @tag @a @b @c tag
tag Term a
a Term b
b
(Just a
a', Just b
b') ->
forall tag a b c.
BinaryPartialStrategy tag a b c =>
tag -> a -> b -> Maybe (Term c)
allConstantHandler @tag @a @b @c tag
tag a
a' b
b'
unaryPartialUnfoldOnce ::
forall a b.
(SupportedPrim b) =>
PartialRuleUnary a b ->
TotalRuleUnary a b ->
PartialRuleUnary a b
unaryPartialUnfoldOnce :: forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> PartialRuleUnary a b
unaryPartialUnfoldOnce PartialRuleUnary a b
partial TotalRuleUnary a b
fallback = PartialRuleUnary a b
ret
where
oneLevel :: TotalRuleUnary a b -> PartialRuleUnary a b
oneLevel :: TotalRuleUnary a b -> PartialRuleUnary a b
oneLevel TotalRuleUnary a b
fallback' Term a
x = case (Term a
x, PartialRuleUnary a b
partial Term a
x) of
(ITETerm Term Bool
cond Term a
vt Term a
vf, Maybe (Term b)
pr) ->
let pt :: Maybe (Term b)
pt = PartialRuleUnary a b
partial Term a
vt
pf :: Maybe (Term b)
pf = PartialRuleUnary a b
partial Term a
vf
in case (Maybe (Term b)
pt, Maybe (Term b)
pf) of
(Maybe (Term b)
Nothing, Maybe (Term b)
Nothing) -> Maybe (Term b)
pr
(Maybe (Term b)
mt, Maybe (Term b)
mf) ->
Term Bool -> Term b -> Term b -> Term b
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond
(Term b -> Term b -> Term b)
-> Maybe (Term b) -> Maybe (Term b -> Term b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Term b) -> (() -> Maybe (Term b)) -> Maybe (Term b)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError Maybe (Term b)
mt (\()
_ -> Term b -> Maybe (Term b)
forall a. a -> Maybe a
Just (Term b -> Maybe (Term b)) -> Term b -> Maybe (Term b)
forall a b. (a -> b) -> a -> b
$ PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
forall a b. PartialFun a b -> (a -> b) -> a -> b
totalize (TotalRuleUnary a b -> PartialRuleUnary a b
oneLevel TotalRuleUnary a b
fallback') TotalRuleUnary a b
fallback' Term a
vt)
Maybe (Term b -> Term b) -> Maybe (Term b) -> Maybe (Term b)
forall a b. Maybe (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe (Term b) -> (() -> Maybe (Term b)) -> Maybe (Term b)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError Maybe (Term b)
mf (\()
_ -> Term b -> Maybe (Term b)
forall a. a -> Maybe a
Just (Term b -> Maybe (Term b)) -> Term b -> Maybe (Term b)
forall a b. (a -> b) -> a -> b
$ PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
forall a b. PartialFun a b -> (a -> b) -> a -> b
totalize (TotalRuleUnary a b -> PartialRuleUnary a b
oneLevel TotalRuleUnary a b
fallback') TotalRuleUnary a b
fallback Term a
vf)
(Term a
_, Maybe (Term b)
pr) -> Maybe (Term b)
pr
ret :: PartialRuleUnary a b
ret :: PartialRuleUnary a b
ret = TotalRuleUnary a b -> PartialRuleUnary a b
oneLevel (forall a b. PartialFun a b -> (a -> b) -> a -> b
totalize @(Term a) @(Term b) PartialRuleUnary a b
partial TotalRuleUnary a b
fallback)
unaryUnfoldOnce ::
forall a b.
(SupportedPrim b) =>
PartialRuleUnary a b ->
TotalRuleUnary a b ->
TotalRuleUnary a b
unaryUnfoldOnce :: forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce PartialRuleUnary a b
partial TotalRuleUnary a b
fallback = PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
forall a b. PartialFun a b -> (a -> b) -> a -> b
totalize (PartialRuleUnary a b -> TotalRuleUnary a b -> PartialRuleUnary a b
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> PartialRuleUnary a b
unaryPartialUnfoldOnce PartialRuleUnary a b
partial TotalRuleUnary a b
fallback) TotalRuleUnary a b
fallback
binaryPartialUnfoldOnce ::
forall a b c.
(SupportedPrim c) =>
PartialRuleBinary a b c ->
TotalRuleBinary a b c ->
PartialRuleBinary a b c
binaryPartialUnfoldOnce :: forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> PartialRuleBinary a b c
binaryPartialUnfoldOnce PartialRuleBinary a b c
partial TotalRuleBinary a b c
fallback = PartialRuleBinary a b c
ret
where
oneLevel :: PartialRuleBinary x y c -> TotalRuleBinary x y c -> PartialRuleBinary x y c
oneLevel :: forall x y.
PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
oneLevel PartialRuleBinary x y c
partial' TotalRuleBinary x y c
fallback' Term x
x Term y
y =
Maybe (Term c) -> (() -> Maybe (Term c)) -> Maybe (Term c)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError
(PartialRuleBinary x y c
partial' Term x
x Term y
y)
( \()
_ ->
case (Term x
x, Term y
y) of
(ITETerm Term Bool
_ ITETerm {} Term x
_, ITETerm {}) -> Maybe (Term c)
forall a. Maybe a
Nothing
(ITETerm Term Bool
_ Term x
_ ITETerm {}, ITETerm {}) -> Maybe (Term c)
forall a. Maybe a
Nothing
(ITETerm {}, ITETerm Term Bool
_ ITETerm {} Term y
_) -> Maybe (Term c)
forall a. Maybe a
Nothing
(ITETerm {}, ITETerm Term Bool
_ Term y
_ ITETerm {}) -> Maybe (Term c)
forall a. Maybe a
Nothing
(ITETerm Term Bool
cond Term x
vt Term x
vf, Term y
_) ->
Term Bool
-> Term x
-> Term x
-> Term y
-> PartialRuleBinary x y c
-> TotalRuleBinary x y c
-> Maybe (Term c)
forall x y.
Term Bool
-> Term x
-> Term x
-> Term y
-> PartialRuleBinary x y c
-> TotalRuleBinary x y c
-> Maybe (Term c)
left Term Bool
cond Term x
vt Term x
vf Term y
y PartialRuleBinary x y c
partial' TotalRuleBinary x y c
fallback'
(Term x
_, ITETerm Term Bool
cond Term y
vt Term y
vf) ->
Term Bool
-> Term y
-> Term y
-> Term x
-> PartialRuleBinary y x c
-> TotalRuleBinary y x c
-> Maybe (Term c)
forall x y.
Term Bool
-> Term x
-> Term x
-> Term y
-> PartialRuleBinary x y c
-> TotalRuleBinary x y c
-> Maybe (Term c)
left Term Bool
cond Term y
vt Term y
vf Term x
x (PartialRuleBinary x y c -> PartialRuleBinary y x c
forall a b c. (a -> b -> c) -> b -> a -> c
flip PartialRuleBinary x y c
partial') (TotalRuleBinary x y c -> TotalRuleBinary y x c
forall a b c. (a -> b -> c) -> b -> a -> c
flip TotalRuleBinary x y c
fallback')
(Term x, Term y)
_ -> Maybe (Term c)
forall a. Maybe a
Nothing
)
left ::
Term Bool ->
Term x ->
Term x ->
Term y ->
PartialRuleBinary x y c ->
TotalRuleBinary x y c ->
Maybe (Term c)
left :: forall x y.
Term Bool
-> Term x
-> Term x
-> Term y
-> PartialRuleBinary x y c
-> TotalRuleBinary x y c
-> Maybe (Term c)
left Term Bool
cond Term x
vt Term x
vf Term y
y PartialRuleBinary x y c
partial' TotalRuleBinary x y c
fallback' =
let pt :: Maybe (Term c)
pt = PartialRuleBinary x y c
partial' Term x
vt Term y
y
pf :: Maybe (Term c)
pf = PartialRuleBinary x y c
partial' Term x
vf Term y
y
in case (Maybe (Term c)
pt, Maybe (Term c)
pf) of
(Maybe (Term c)
Nothing, Maybe (Term c)
Nothing) -> Maybe (Term c)
forall a. Maybe a
Nothing
(Maybe (Term c)
mt, Maybe (Term c)
mf) ->
Term Bool -> Term c -> Term c -> Term c
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond
(Term c -> Term c -> Term c)
-> Maybe (Term c) -> Maybe (Term c -> Term c)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe (Term c) -> (() -> Maybe (Term c)) -> Maybe (Term c)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError Maybe (Term c)
mt (\()
_ -> Term c -> Maybe (Term c)
forall a. a -> Maybe a
Just (Term c -> Maybe (Term c)) -> Term c -> Maybe (Term c)
forall a b. (a -> b) -> a -> b
$ PartialRuleBinary x y c
-> TotalRuleBinary x y c -> TotalRuleBinary x y c
forall a b c. (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 (PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
forall x y.
PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
oneLevel PartialRuleBinary x y c
partial' TotalRuleBinary x y c
fallback') TotalRuleBinary x y c
fallback' Term x
vt Term y
y)
Maybe (Term c -> Term c) -> Maybe (Term c) -> Maybe (Term c)
forall a b. Maybe (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Maybe (Term c) -> (() -> Maybe (Term c)) -> Maybe (Term c)
forall a. Maybe a -> (() -> Maybe a) -> Maybe a
forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError Maybe (Term c)
mf (\()
_ -> Term c -> Maybe (Term c)
forall a. a -> Maybe a
Just (Term c -> Maybe (Term c)) -> Term c -> Maybe (Term c)
forall a b. (a -> b) -> a -> b
$ PartialRuleBinary x y c
-> TotalRuleBinary x y c -> TotalRuleBinary x y c
forall a b c. (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 (PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
forall x y.
PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
oneLevel PartialRuleBinary x y c
partial' TotalRuleBinary x y c
fallback') TotalRuleBinary x y c
fallback' Term x
vf Term y
y)
ret :: PartialRuleBinary a b c
ret :: PartialRuleBinary a b c
ret = PartialRuleBinary a b c
-> TotalRuleBinary a b c -> PartialRuleBinary a b c
forall x y.
PartialRuleBinary x y c
-> TotalRuleBinary x y c -> PartialRuleBinary x y c
oneLevel PartialRuleBinary a b c
partial (forall a b c. (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 @(Term a) @(Term b) @(Term c) PartialRuleBinary a b c
partial TotalRuleBinary a b c
fallback)
binaryUnfoldOnce ::
forall a b c.
(SupportedPrim c) =>
PartialRuleBinary a b c ->
TotalRuleBinary a b c ->
TotalRuleBinary a b c
binaryUnfoldOnce :: forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce PartialRuleBinary a b c
partial TotalRuleBinary a b c
fallback = PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
forall a b c. (a -> PartialFun b c) -> (a -> b -> c) -> a -> b -> c
totalize2 (PartialRuleBinary a b c
-> TotalRuleBinary a b c -> PartialRuleBinary a b c
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> PartialRuleBinary a b c
binaryPartialUnfoldOnce PartialRuleBinary a b c
partial TotalRuleBinary a b c
fallback) TotalRuleBinary a b c
fallback
generalUnaryUnfolded ::
forall a b.
(Typeable a, SupportedPrim b) =>
(a -> b) ->
(Term a -> Term b) ->
Term a ->
Term b
generalUnaryUnfolded :: forall a b.
(Typeable a, SupportedPrim b) =>
(a -> b) -> (Term a -> Term b) -> Term a -> Term b
generalUnaryUnfolded a -> b
compute =
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
forall a b.
SupportedPrim b =>
PartialRuleUnary a b -> TotalRuleUnary a b -> TotalRuleUnary a b
unaryUnfoldOnce
( \case
ConTerm a
lv -> Term b -> Maybe (Term b)
forall a. a -> Maybe a
Just (Term b -> Maybe (Term b)) -> Term b -> Maybe (Term b)
forall a b. (a -> b) -> a -> b
$ b -> Term b
forall t. SupportedPrim t => t -> Term t
conTerm (b -> Term b) -> b -> Term b
forall a b. (a -> b) -> a -> b
$ a -> b
compute a
lv
Term a
_ -> Maybe (Term b)
forall a. Maybe a
Nothing
)
generalBinaryUnfolded ::
forall a b c.
(Typeable a, Typeable b, SupportedPrim c) =>
(a -> b -> c) ->
(Term a -> Term b -> Term c) ->
Term a ->
Term b ->
Term c
generalBinaryUnfolded :: forall a b c.
(Typeable a, Typeable b, SupportedPrim c) =>
(a -> b -> c)
-> (Term a -> Term b -> Term c) -> Term a -> Term b -> Term c
generalBinaryUnfolded a -> b -> c
compute =
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
forall a b c.
SupportedPrim c =>
PartialRuleBinary a b c
-> TotalRuleBinary a b c -> TotalRuleBinary a b c
binaryUnfoldOnce
( \Term a
l Term b
r -> case (Term a
l, Term b
r) of
(ConTerm a
lv, ConTerm b
rv) -> Term c -> Maybe (Term c)
forall a. a -> Maybe a
Just (Term c -> Maybe (Term c)) -> Term c -> Maybe (Term c)
forall a b. (a -> b) -> a -> b
$ c -> Term c
forall t. SupportedPrim t => t -> Term t
conTerm (c -> Term c) -> c -> Term c
forall a b. (a -> b) -> a -> b
$ a -> b -> c
compute a
lv b
rv
(Term a, Term b)
_ -> Maybe (Term c)
forall a. Maybe a
Nothing
)